@pawells/typescript-common 2.0.0 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (412) hide show
  1. package/README.md +350 -224
  2. package/{build → dist}/array/array-chunk.d.ts +1 -1
  3. package/{build → dist}/array/array-chunk.js +2 -3
  4. package/{build → dist}/array/array-compact.d.ts +1 -1
  5. package/{build → dist}/array/array-compact.js +1 -2
  6. package/{build → dist}/array/array-contains.d.ts +1 -1
  7. package/{build → dist}/array/array-contains.js +2 -3
  8. package/{build → dist}/array/array-count-by.d.ts +1 -1
  9. package/{build → dist}/array/array-count-by.js +2 -3
  10. package/{build → dist}/array/array-difference.d.ts +12 -5
  11. package/dist/array/array-difference.d.ts.map +1 -0
  12. package/dist/array/array-difference.js +70 -0
  13. package/dist/array/array-element.js +1 -0
  14. package/{build → dist}/array/array-filter.d.ts +1 -1
  15. package/{build → dist}/array/array-filter.js +1 -2
  16. package/{build → dist}/array/array-flatten.d.ts +2 -2
  17. package/{build → dist}/array/array-flatten.d.ts.map +1 -1
  18. package/{build → dist}/array/array-flatten.js +1 -2
  19. package/{build → dist}/array/array-group-by.d.ts +1 -1
  20. package/{build → dist}/array/array-group-by.d.ts.map +1 -1
  21. package/{build → dist}/array/array-group-by.js +10 -9
  22. package/{build → dist}/array/array-intersection.d.ts +12 -5
  23. package/dist/array/array-intersection.d.ts.map +1 -0
  24. package/dist/array/array-intersection.js +79 -0
  25. package/{build → dist}/array/array-partition.d.ts +1 -1
  26. package/{build → dist}/array/array-partition.js +2 -3
  27. package/{build → dist}/array/array-range.d.ts +1 -1
  28. package/{build → dist}/array/array-range.js +1 -2
  29. package/{build → dist}/array/array-sample.d.ts +2 -2
  30. package/{build → dist}/array/array-sample.js +3 -5
  31. package/{build → dist}/array/array-shuffle.d.ts +1 -1
  32. package/{build → dist}/array/array-shuffle.js +1 -2
  33. package/{build → dist}/array/array-sort-by.d.ts +1 -1
  34. package/{build → dist}/array/array-sort-by.js +1 -2
  35. package/{build → dist}/array/array-zip.d.ts +1 -1
  36. package/{build → dist}/array/array-zip.js +1 -2
  37. package/{build → dist}/array/assert.d.ts +5 -5
  38. package/{build → dist}/array/assert.d.ts.map +1 -1
  39. package/{build → dist}/array/assert.js +13 -14
  40. package/{build → dist}/array/index.js +0 -1
  41. package/{build → dist}/array/types.d.ts +20 -2
  42. package/{build → dist}/array/types.d.ts.map +1 -1
  43. package/dist/array/types.js +1 -0
  44. package/{build → dist}/array/unique.d.ts +1 -1
  45. package/{build → dist}/array/unique.js +1 -2
  46. package/dist/asserts/errors.d.ts.map +1 -0
  47. package/{build → dist}/asserts/errors.js +5 -3
  48. package/{build → dist}/asserts/generic.d.ts +23 -3
  49. package/dist/asserts/generic.d.ts.map +1 -0
  50. package/{build → dist}/asserts/generic.js +33 -7
  51. package/dist/asserts/index.d.ts +47 -0
  52. package/dist/asserts/index.d.ts.map +1 -0
  53. package/dist/asserts/index.js +46 -0
  54. package/{build → dist}/asserts/internal-utils.d.ts.map +1 -1
  55. package/{build → dist}/asserts/internal-utils.js +0 -1
  56. package/{build → dist}/asserts/types.d.ts +56 -17
  57. package/dist/asserts/types.d.ts.map +1 -0
  58. package/dist/asserts/types.js +1 -0
  59. package/{build → dist}/asserts/utils.d.ts +5 -21
  60. package/dist/asserts/utils.d.ts.map +1 -0
  61. package/{build → dist}/asserts/utils.js +12 -36
  62. package/{build → dist}/boolean/assert.d.ts +1 -2
  63. package/{build → dist}/boolean/assert.d.ts.map +1 -1
  64. package/{build → dist}/boolean/assert.js +1 -3
  65. package/dist/boolean/index.d.ts +13 -0
  66. package/dist/boolean/index.d.ts.map +1 -0
  67. package/dist/boolean/index.js +12 -0
  68. package/{build → dist}/enum/enum-entries.d.ts +1 -1
  69. package/dist/enum/enum-entries.d.ts.map +1 -0
  70. package/{build → dist}/enum/enum-entries.js +0 -1
  71. package/{build → dist}/enum/enum-key-by-value.d.ts +1 -1
  72. package/dist/enum/enum-key-by-value.d.ts.map +1 -0
  73. package/{build → dist}/enum/enum-key-by-value.js +0 -1
  74. package/{build → dist}/enum/enum-keys.js +0 -1
  75. package/{build → dist}/enum/enum-safe-value.d.ts +1 -1
  76. package/dist/enum/enum-safe-value.d.ts.map +1 -0
  77. package/{build → dist}/enum/enum-safe-value.js +0 -1
  78. package/{build → dist}/enum/enum-values.js +0 -1
  79. package/{build → dist}/enum/index.d.ts +1 -1
  80. package/dist/enum/index.d.ts.map +1 -0
  81. package/{build → dist}/enum/index.js +1 -2
  82. package/dist/enum/types.js +1 -0
  83. package/{build → dist}/enum/validate-enum-value.d.ts +1 -1
  84. package/dist/enum/validate-enum-value.d.ts.map +1 -0
  85. package/{build → dist}/enum/validate-enum-value.js +0 -1
  86. package/{build → dist}/function/compose.d.ts +6 -0
  87. package/dist/function/compose.d.ts.map +1 -0
  88. package/{build → dist}/function/compose.js +0 -1
  89. package/{build → dist}/function/debounce.d.ts +6 -0
  90. package/dist/function/debounce.d.ts.map +1 -0
  91. package/{build → dist}/function/debounce.js +6 -1
  92. package/{build → dist}/function/index.js +0 -1
  93. package/dist/function/memoize.d.ts +43 -0
  94. package/dist/function/memoize.d.ts.map +1 -0
  95. package/dist/function/memoize.js +59 -0
  96. package/{build → dist}/function/once.d.ts.map +1 -1
  97. package/{build → dist}/function/once.js +1 -1
  98. package/{build → dist}/function/sleep.js +0 -1
  99. package/{build → dist}/function/throttle.d.ts +7 -0
  100. package/dist/function/throttle.d.ts.map +1 -0
  101. package/{build → dist}/function/throttle.js +7 -1
  102. package/dist/function/types.d.ts +18 -0
  103. package/dist/function/types.d.ts.map +1 -0
  104. package/dist/function/types.js +1 -0
  105. package/dist/index.d.ts +11 -0
  106. package/dist/index.d.ts.map +1 -0
  107. package/dist/index.js +10 -0
  108. package/{build → dist}/lru-cache.d.ts +19 -0
  109. package/dist/lru-cache.d.ts.map +1 -0
  110. package/{build → dist}/lru-cache.js +24 -2
  111. package/{build → dist}/number/assert.js +0 -1
  112. package/dist/number/index.d.ts +13 -0
  113. package/dist/number/index.d.ts.map +1 -0
  114. package/dist/number/index.js +12 -0
  115. package/{build → dist}/object/assert-object.d.ts +5 -1
  116. package/{build → dist}/object/assert-object.d.ts.map +1 -1
  117. package/{build → dist}/object/assert-object.js +4 -1
  118. package/{build → dist}/object/assert.d.ts +1 -1
  119. package/dist/object/assert.d.ts.map +1 -0
  120. package/{build → dist}/object/assert.js +7 -29
  121. package/{build → dist}/object/clone.d.ts.map +1 -1
  122. package/{build → dist}/object/clone.js +8 -5
  123. package/{build → dist}/object/equals.d.ts.map +1 -1
  124. package/{build → dist}/object/equals.js +3 -7
  125. package/dist/object/filter-cached.d.ts +44 -0
  126. package/{build → dist}/object/filter-cached.d.ts.map +1 -1
  127. package/{build → dist}/object/filter-cached.js +41 -2
  128. package/{build → dist}/object/filter.d.ts.map +1 -1
  129. package/{build → dist}/object/filter.js +12 -5
  130. package/{build → dist}/object/has-circular-reference.d.ts.map +1 -1
  131. package/{build → dist}/object/has-circular-reference.js +4 -2
  132. package/{build → dist}/object/hash.d.ts +4 -0
  133. package/dist/object/hash.d.ts.map +1 -0
  134. package/{build → dist}/object/hash.js +20 -7
  135. package/{build → dist}/object/index.d.ts +2 -2
  136. package/{build → dist}/object/index.d.ts.map +1 -1
  137. package/{build → dist}/object/index.js +1 -2
  138. package/{build → dist}/object/json-circular-replacer.d.ts.map +1 -1
  139. package/{build → dist}/object/json-circular-replacer.js +0 -1
  140. package/{build → dist}/object/key-value-pairs.js +0 -1
  141. package/dist/object/map-cached.d.ts +31 -0
  142. package/dist/object/map-cached.d.ts.map +1 -0
  143. package/{build → dist}/object/map-cached.js +34 -6
  144. package/{build → dist}/object/map.js +0 -1
  145. package/{build → dist}/object/merge.d.ts.map +1 -1
  146. package/{build → dist}/object/merge.js +7 -7
  147. package/{build → dist}/object/object-diff.d.ts +2 -2
  148. package/{build → dist}/object/object-diff.d.ts.map +1 -1
  149. package/{build → dist}/object/object-diff.js +11 -5
  150. package/{build → dist}/object/object-flatten.d.ts +1 -1
  151. package/{build → dist}/object/object-flatten.d.ts.map +1 -1
  152. package/{build → dist}/object/object-flatten.js +6 -4
  153. package/{build → dist}/object/object-invert.js +0 -1
  154. package/{build → dist}/object/omit.js +0 -1
  155. package/{build → dist}/object/pick.js +0 -1
  156. package/{build → dist}/object/property-paths.js +6 -7
  157. package/dist/object/security-utils.d.ts +193 -0
  158. package/dist/object/security-utils.d.ts.map +1 -0
  159. package/dist/object/security-utils.js +297 -0
  160. package/{build → dist}/object/sort-keys.d.ts +1 -1
  161. package/{build → dist}/object/sort-keys.d.ts.map +1 -1
  162. package/{build → dist}/object/sort-keys.js +18 -11
  163. package/{build → dist}/object/types.d.ts +60 -19
  164. package/dist/object/types.d.ts.map +1 -0
  165. package/dist/object/types.js +1 -0
  166. package/{build → dist}/string/assert.d.ts +5 -0
  167. package/dist/string/assert.d.ts.map +1 -0
  168. package/{build → dist}/string/assert.js +11 -1
  169. package/{build → dist}/string/case-conversion.js +0 -1
  170. package/{build → dist}/string/comparison.d.ts.map +1 -1
  171. package/{build → dist}/string/comparison.js +3 -1
  172. package/{build → dist}/string/formatting.d.ts.map +1 -1
  173. package/{build → dist}/string/formatting.js +5 -3
  174. package/{build → dist}/string/index.js +0 -1
  175. package/{build → dist}/string/transformation.js +0 -1
  176. package/dist/string/types.d.ts +118 -0
  177. package/dist/string/types.d.ts.map +1 -0
  178. package/dist/string/types.js +1 -0
  179. package/{build → dist}/string/validation.js +0 -1
  180. package/dist/time/elapsed-time/constants.d.ts +36 -0
  181. package/{build → dist}/time/elapsed-time/constants.d.ts.map +1 -1
  182. package/{build → dist}/time/elapsed-time/constants.js +32 -3
  183. package/{build → dist}/time/elapsed-time/elapsed-time.d.ts +67 -15
  184. package/dist/time/elapsed-time/elapsed-time.d.ts.map +1 -0
  185. package/{build → dist}/time/elapsed-time/elapsed-time.js +172 -78
  186. package/dist/time/elapsed-time/types.d.ts +336 -0
  187. package/dist/time/elapsed-time/types.d.ts.map +1 -0
  188. package/dist/time/elapsed-time/types.js +1 -0
  189. package/{build → dist}/time/elapsed-time/utils.d.ts +1 -1
  190. package/dist/time/elapsed-time/utils.d.ts.map +1 -0
  191. package/{build → dist}/time/elapsed-time/utils.js +0 -1
  192. package/{build → dist}/time/index.d.ts +0 -2
  193. package/{build → dist}/time/index.d.ts.map +1 -1
  194. package/{build → dist}/time/index.js +0 -2
  195. package/{build → dist}/time/stopwatch/entry.d.ts +1 -1
  196. package/dist/time/stopwatch/entry.d.ts.map +1 -0
  197. package/{build → dist}/time/stopwatch/entry.js +0 -1
  198. package/{build → dist}/time/stopwatch/stopwatch.d.ts +9 -3
  199. package/dist/time/stopwatch/stopwatch.d.ts.map +1 -0
  200. package/{build → dist}/time/stopwatch/stopwatch.js +9 -4
  201. package/package.json +58 -81
  202. package/LICENSE +0 -21
  203. package/build/array/array-chunk.js.map +0 -1
  204. package/build/array/array-compact.js.map +0 -1
  205. package/build/array/array-contains.js.map +0 -1
  206. package/build/array/array-count-by.js.map +0 -1
  207. package/build/array/array-difference.d.ts.map +0 -1
  208. package/build/array/array-difference.js +0 -51
  209. package/build/array/array-difference.js.map +0 -1
  210. package/build/array/array-element.js +0 -2
  211. package/build/array/array-element.js.map +0 -1
  212. package/build/array/array-filter.js.map +0 -1
  213. package/build/array/array-flatten.js.map +0 -1
  214. package/build/array/array-group-by.js.map +0 -1
  215. package/build/array/array-intersection.d.ts.map +0 -1
  216. package/build/array/array-intersection.js +0 -57
  217. package/build/array/array-intersection.js.map +0 -1
  218. package/build/array/array-partition.js.map +0 -1
  219. package/build/array/array-range.js.map +0 -1
  220. package/build/array/array-sample.js.map +0 -1
  221. package/build/array/array-shuffle.js.map +0 -1
  222. package/build/array/array-sort-by.js.map +0 -1
  223. package/build/array/array-zip.js.map +0 -1
  224. package/build/array/assert.js.map +0 -1
  225. package/build/array/index.js.map +0 -1
  226. package/build/array/types.js +0 -2
  227. package/build/array/types.js.map +0 -1
  228. package/build/array/unique.js.map +0 -1
  229. package/build/asserts/errors.d.ts.map +0 -1
  230. package/build/asserts/errors.js.map +0 -1
  231. package/build/asserts/generic.d.ts.map +0 -1
  232. package/build/asserts/generic.js.map +0 -1
  233. package/build/asserts/index.d.ts +0 -41
  234. package/build/asserts/index.d.ts.map +0 -1
  235. package/build/asserts/index.js +0 -41
  236. package/build/asserts/index.js.map +0 -1
  237. package/build/asserts/internal-utils.js.map +0 -1
  238. package/build/asserts/types.d.ts.map +0 -1
  239. package/build/asserts/types.js +0 -2
  240. package/build/asserts/types.js.map +0 -1
  241. package/build/asserts/utils.d.ts.map +0 -1
  242. package/build/asserts/utils.js.map +0 -1
  243. package/build/boolean/assert.js.map +0 -1
  244. package/build/boolean/index.d.ts +0 -9
  245. package/build/boolean/index.d.ts.map +0 -1
  246. package/build/boolean/index.js +0 -9
  247. package/build/boolean/index.js.map +0 -1
  248. package/build/enum/enum-entries.d.ts.map +0 -1
  249. package/build/enum/enum-entries.js.map +0 -1
  250. package/build/enum/enum-key-by-value.d.ts.map +0 -1
  251. package/build/enum/enum-key-by-value.js.map +0 -1
  252. package/build/enum/enum-keys.js.map +0 -1
  253. package/build/enum/enum-safe-value.d.ts.map +0 -1
  254. package/build/enum/enum-safe-value.js.map +0 -1
  255. package/build/enum/enum-values.js.map +0 -1
  256. package/build/enum/index.d.ts.map +0 -1
  257. package/build/enum/index.js.map +0 -1
  258. package/build/enum/types.js +0 -2
  259. package/build/enum/types.js.map +0 -1
  260. package/build/enum/validate-enum-value.d.ts.map +0 -1
  261. package/build/enum/validate-enum-value.js.map +0 -1
  262. package/build/function/compose.d.ts.map +0 -1
  263. package/build/function/compose.js.map +0 -1
  264. package/build/function/debounce.d.ts.map +0 -1
  265. package/build/function/debounce.js.map +0 -1
  266. package/build/function/index.js.map +0 -1
  267. package/build/function/memoize.d.ts +0 -30
  268. package/build/function/memoize.d.ts.map +0 -1
  269. package/build/function/memoize.js +0 -44
  270. package/build/function/memoize.js.map +0 -1
  271. package/build/function/once.js.map +0 -1
  272. package/build/function/sleep.js.map +0 -1
  273. package/build/function/throttle.d.ts.map +0 -1
  274. package/build/function/throttle.js.map +0 -1
  275. package/build/function/types.d.ts +0 -5
  276. package/build/function/types.d.ts.map +0 -1
  277. package/build/function/types.js +0 -2
  278. package/build/function/types.js.map +0 -1
  279. package/build/index.d.ts +0 -38
  280. package/build/index.d.ts.map +0 -1
  281. package/build/index.js +0 -64
  282. package/build/index.js.map +0 -1
  283. package/build/lru-cache.d.ts.map +0 -1
  284. package/build/lru-cache.js.map +0 -1
  285. package/build/number/assert.js.map +0 -1
  286. package/build/number/index.d.ts +0 -9
  287. package/build/number/index.d.ts.map +0 -1
  288. package/build/number/index.js +0 -9
  289. package/build/number/index.js.map +0 -1
  290. package/build/object/assert-object.js.map +0 -1
  291. package/build/object/assert.d.ts.map +0 -1
  292. package/build/object/assert.js.map +0 -1
  293. package/build/object/clone.js.map +0 -1
  294. package/build/object/equals.js.map +0 -1
  295. package/build/object/filter-cached.d.ts +0 -21
  296. package/build/object/filter-cached.js.map +0 -1
  297. package/build/object/filter.js.map +0 -1
  298. package/build/object/has-circular-reference.js.map +0 -1
  299. package/build/object/hash.d.ts.map +0 -1
  300. package/build/object/hash.js.map +0 -1
  301. package/build/object/index.js.map +0 -1
  302. package/build/object/json-circular-replacer.js.map +0 -1
  303. package/build/object/key-value-pairs.js.map +0 -1
  304. package/build/object/map-cached.d.ts +0 -20
  305. package/build/object/map-cached.d.ts.map +0 -1
  306. package/build/object/map-cached.js.map +0 -1
  307. package/build/object/map.js.map +0 -1
  308. package/build/object/merge.js.map +0 -1
  309. package/build/object/object-diff.js.map +0 -1
  310. package/build/object/object-flatten.js.map +0 -1
  311. package/build/object/object-invert.js.map +0 -1
  312. package/build/object/omit.js.map +0 -1
  313. package/build/object/pick.js.map +0 -1
  314. package/build/object/property-paths.js.map +0 -1
  315. package/build/object/security-utils.d.ts +0 -59
  316. package/build/object/security-utils.d.ts.map +0 -1
  317. package/build/object/security-utils.js +0 -161
  318. package/build/object/security-utils.js.map +0 -1
  319. package/build/object/sort-keys.js.map +0 -1
  320. package/build/object/types.d.ts.map +0 -1
  321. package/build/object/types.js +0 -6
  322. package/build/object/types.js.map +0 -1
  323. package/build/string/assert.d.ts.map +0 -1
  324. package/build/string/assert.js.map +0 -1
  325. package/build/string/case-conversion.js.map +0 -1
  326. package/build/string/comparison.js.map +0 -1
  327. package/build/string/formatting.js.map +0 -1
  328. package/build/string/index.js.map +0 -1
  329. package/build/string/transformation.js.map +0 -1
  330. package/build/string/types.d.ts +0 -44
  331. package/build/string/types.d.ts.map +0 -1
  332. package/build/string/types.js +0 -2
  333. package/build/string/types.js.map +0 -1
  334. package/build/string/validation.js.map +0 -1
  335. package/build/time/elapsed-time/constants.d.ts +0 -10
  336. package/build/time/elapsed-time/constants.js.map +0 -1
  337. package/build/time/elapsed-time/elapsed-time.d.ts.map +0 -1
  338. package/build/time/elapsed-time/elapsed-time.js.map +0 -1
  339. package/build/time/elapsed-time/types.d.ts +0 -150
  340. package/build/time/elapsed-time/types.d.ts.map +0 -1
  341. package/build/time/elapsed-time/types.js +0 -2
  342. package/build/time/elapsed-time/types.js.map +0 -1
  343. package/build/time/elapsed-time/utils.d.ts.map +0 -1
  344. package/build/time/elapsed-time/utils.js.map +0 -1
  345. package/build/time/index.js.map +0 -1
  346. package/build/time/stopwatch/entry-types.d.ts +0 -13
  347. package/build/time/stopwatch/entry-types.d.ts.map +0 -1
  348. package/build/time/stopwatch/entry-types.js +0 -2
  349. package/build/time/stopwatch/entry-types.js.map +0 -1
  350. package/build/time/stopwatch/entry.d.ts.map +0 -1
  351. package/build/time/stopwatch/entry.js.map +0 -1
  352. package/build/time/stopwatch/stopwatch.d.ts.map +0 -1
  353. package/build/time/stopwatch/stopwatch.js.map +0 -1
  354. /package/{build → dist}/array/array-chunk.d.ts.map +0 -0
  355. /package/{build → dist}/array/array-compact.d.ts.map +0 -0
  356. /package/{build → dist}/array/array-contains.d.ts.map +0 -0
  357. /package/{build → dist}/array/array-count-by.d.ts.map +0 -0
  358. /package/{build → dist}/array/array-element.d.ts +0 -0
  359. /package/{build → dist}/array/array-element.d.ts.map +0 -0
  360. /package/{build → dist}/array/array-filter.d.ts.map +0 -0
  361. /package/{build → dist}/array/array-partition.d.ts.map +0 -0
  362. /package/{build → dist}/array/array-range.d.ts.map +0 -0
  363. /package/{build → dist}/array/array-sample.d.ts.map +0 -0
  364. /package/{build → dist}/array/array-shuffle.d.ts.map +0 -0
  365. /package/{build → dist}/array/array-sort-by.d.ts.map +0 -0
  366. /package/{build → dist}/array/array-zip.d.ts.map +0 -0
  367. /package/{build → dist}/array/index.d.ts +0 -0
  368. /package/{build → dist}/array/index.d.ts.map +0 -0
  369. /package/{build → dist}/array/unique.d.ts.map +0 -0
  370. /package/{build → dist}/asserts/errors.d.ts +0 -0
  371. /package/{build → dist}/asserts/internal-utils.d.ts +0 -0
  372. /package/{build → dist}/enum/enum-keys.d.ts +0 -0
  373. /package/{build → dist}/enum/enum-keys.d.ts.map +0 -0
  374. /package/{build → dist}/enum/enum-values.d.ts +0 -0
  375. /package/{build → dist}/enum/enum-values.d.ts.map +0 -0
  376. /package/{build → dist}/enum/types.d.ts +0 -0
  377. /package/{build → dist}/enum/types.d.ts.map +0 -0
  378. /package/{build → dist}/function/index.d.ts +0 -0
  379. /package/{build → dist}/function/index.d.ts.map +0 -0
  380. /package/{build → dist}/function/once.d.ts +0 -0
  381. /package/{build → dist}/function/sleep.d.ts +0 -0
  382. /package/{build → dist}/function/sleep.d.ts.map +0 -0
  383. /package/{build → dist}/number/assert.d.ts +0 -0
  384. /package/{build → dist}/number/assert.d.ts.map +0 -0
  385. /package/{build → dist}/object/clone.d.ts +0 -0
  386. /package/{build → dist}/object/equals.d.ts +0 -0
  387. /package/{build → dist}/object/filter.d.ts +0 -0
  388. /package/{build → dist}/object/has-circular-reference.d.ts +0 -0
  389. /package/{build → dist}/object/json-circular-replacer.d.ts +0 -0
  390. /package/{build → dist}/object/key-value-pairs.d.ts +0 -0
  391. /package/{build → dist}/object/key-value-pairs.d.ts.map +0 -0
  392. /package/{build → dist}/object/map.d.ts +0 -0
  393. /package/{build → dist}/object/map.d.ts.map +0 -0
  394. /package/{build → dist}/object/merge.d.ts +0 -0
  395. /package/{build → dist}/object/object-invert.d.ts +0 -0
  396. /package/{build → dist}/object/object-invert.d.ts.map +0 -0
  397. /package/{build → dist}/object/omit.d.ts +0 -0
  398. /package/{build → dist}/object/omit.d.ts.map +0 -0
  399. /package/{build → dist}/object/pick.d.ts +0 -0
  400. /package/{build → dist}/object/pick.d.ts.map +0 -0
  401. /package/{build → dist}/object/property-paths.d.ts +0 -0
  402. /package/{build → dist}/object/property-paths.d.ts.map +0 -0
  403. /package/{build → dist}/string/case-conversion.d.ts +0 -0
  404. /package/{build → dist}/string/case-conversion.d.ts.map +0 -0
  405. /package/{build → dist}/string/comparison.d.ts +0 -0
  406. /package/{build → dist}/string/formatting.d.ts +0 -0
  407. /package/{build → dist}/string/index.d.ts +0 -0
  408. /package/{build → dist}/string/index.d.ts.map +0 -0
  409. /package/{build → dist}/string/transformation.d.ts +0 -0
  410. /package/{build → dist}/string/transformation.d.ts.map +0 -0
  411. /package/{build → dist}/string/validation.d.ts +0 -0
  412. /package/{build → dist}/string/validation.d.ts.map +0 -0
@@ -8,6 +8,12 @@
8
8
  * @typeParam K - Key type
9
9
  * @typeParam V - Value type
10
10
  *
11
+ * @warning Do not cache sensitive objects (API keys, tokens, passwords, PII).
12
+ * Cache entries remain in memory until evicted or cleared. If cache is inspected
13
+ * (via debugger, memory dump, or compromised process), sensitive values will be exposed.
14
+ * For sensitive data, prefer ephemeral processing without caching, or implement
15
+ * automatic expiration and secure clearing (e.g., overwrite before eviction).
16
+ *
11
17
  * @example
12
18
  * ```typescript
13
19
  * const cache = new LRUCache<string, number>(2);
@@ -53,6 +59,12 @@ export class LRUCache {
53
59
  * @param key - The key to look up
54
60
  * @returns The cached value, or `undefined` if not found
55
61
  *
62
+ * @remarks
63
+ * Each cache hit triggers an internal Map delete and re-insert operation to maintain
64
+ * LRU order. This is O(1) amortized, but introduces per-access overhead.
65
+ * For read-heavy workloads, consider a timestamp-based LRU approach to reduce
66
+ * per-access cost, though it adds space overhead for timestamp storage.
67
+ *
56
68
  * @example
57
69
  * ```typescript
58
70
  * const cache = new LRUCache<string, number>(2);
@@ -66,7 +78,9 @@ export class LRUCache {
66
78
  return undefined;
67
79
  }
68
80
  const value = this._map.get(key);
69
- // Move to end (mark as recently used)
81
+ // LRU maintenance: re-insert at map tail on every read hit.
82
+ // This is O(1) but involves Map.delete + Map.set per call.
83
+ // For read-heavy workloads, consider a timestamp-based LRU alternative.
70
84
  this._map.delete(key);
71
85
  this._map.set(key, value);
72
86
  return value;
@@ -135,5 +149,13 @@ export class LRUCache {
135
149
  clear() {
136
150
  this._map.clear();
137
151
  }
152
+ /**
153
+ * Removes a specific key from the cache.
154
+ *
155
+ * @param key - The key to delete
156
+ * @returns `true` if the key existed and was deleted, `false` otherwise
157
+ */
158
+ delete(key) {
159
+ return this._map.delete(key);
160
+ }
138
161
  }
139
- //# sourceMappingURL=lru-cache.js.map
@@ -143,4 +143,3 @@ export function AssertNumber(value, args = {}, exception = {}) {
143
143
  ThrowException(exception);
144
144
  }
145
145
  }
146
- //# sourceMappingURL=assert.js.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Number assertion functions and types.
3
+ *
4
+ * Provides assertion helpers for validating numeric values and ranges at runtime.
5
+ *
6
+ * Currently contains only assertion utilities. This module structure is designed
7
+ * to accommodate additional number utilities in the future (e.g., formatting,
8
+ * conversion functions).
9
+ *
10
+ * @module number
11
+ */
12
+ export * from './assert.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/number/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,aAAa,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Number assertion functions and types.
3
+ *
4
+ * Provides assertion helpers for validating numeric values and ranges at runtime.
5
+ *
6
+ * Currently contains only assertion utilities. This module structure is designed
7
+ * to accommodate additional number utilities in the future (e.g., formatting,
8
+ * conversion functions).
9
+ *
10
+ * @module number
11
+ */
12
+ export * from './assert.js';
@@ -1,6 +1,10 @@
1
1
  /**
2
2
  * Type guard that checks if the provided value is a non-null, non-array object.
3
3
  *
4
+ * NOTE: Despite the `assert-` prefix, this file exports a type guard predicate (`IsObject`),
5
+ * not an assertion function that throws. Type narrowing predicates are grouped here by
6
+ * convention alongside related assertion functions (see `AssertObject` in the asserts module).
7
+ *
4
8
  * Use this for type narrowing in conditionals. For runtime assertions that
5
9
  * throw on failure, use {@link AssertObject} from the asserts module.
6
10
  *
@@ -15,5 +19,5 @@
15
19
  * }
16
20
  * ```
17
21
  */
18
- export declare function IsObject(item: unknown): item is Record<string, any>;
22
+ export declare function IsObject(item: unknown): item is Record<string, unknown>;
19
23
  //# sourceMappingURL=assert-object.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assert-object.d.ts","sourceRoot":"","sources":["../../src/object/assert-object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAEnE"}
1
+ {"version":3,"file":"assert-object.d.ts","sourceRoot":"","sources":["../../src/object/assert-object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEvE"}
@@ -1,6 +1,10 @@
1
1
  /**
2
2
  * Type guard that checks if the provided value is a non-null, non-array object.
3
3
  *
4
+ * NOTE: Despite the `assert-` prefix, this file exports a type guard predicate (`IsObject`),
5
+ * not an assertion function that throws. Type narrowing predicates are grouped here by
6
+ * convention alongside related assertion functions (see `AssertObject` in the asserts module).
7
+ *
4
8
  * Use this for type narrowing in conditionals. For runtime assertions that
5
9
  * throw on failure, use {@link AssertObject} from the asserts module.
6
10
  *
@@ -18,4 +22,3 @@
18
22
  export function IsObject(item) {
19
23
  return item !== null && typeof item === 'object' && !Array.isArray(item);
20
24
  }
21
- //# sourceMappingURL=assert-object.js.map
@@ -1,4 +1,4 @@
1
- import { IAssertException } from '../asserts/types.js';
1
+ import type { IAssertException } from '../asserts/types.js';
2
2
  import { SimpleError } from '../asserts/errors.js';
3
3
  /**
4
4
  * Error thrown when a value is not a valid object or fails an object assertion.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/object/assert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,WAAW;gBAC/B,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;gBACvC,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,GAAE,gBAAqB,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASvH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,GAAE,gBAAqB,GAAG,IAAI,CAU9I;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,GAAE,gBAAqB,GAAG,IAAI,CAUjJ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,GAAE,gBAAqB,GAAG,IAAI,CAW9I"}
@@ -1,7 +1,6 @@
1
1
  import { SetExceptionClass, SetExceptionMessage, ThrowException } from '../asserts/utils.js';
2
2
  import { SimpleError } from '../asserts/errors.js';
3
- /** Maximum number of characters to include from a value in an error message. */
4
- const MAX_VALUE_DISPLAY_LENGTH = 100;
3
+ import { safeDisplay } from '../asserts/generic.js';
5
4
  /**
6
5
  * Error thrown when a value is not a valid object or fails an object assertion.
7
6
  *
@@ -52,28 +51,8 @@ export function AssertObject(value, exception = {}) {
52
51
  SetExceptionClass(exception, ObjectError);
53
52
  if (typeof value !== 'object' || value === null || Array.isArray(value)) {
54
53
  const actualType = value === null ? 'null' : Array.isArray(value) ? 'array' : typeof value;
55
- let valueStr;
56
- try {
57
- if (typeof value === 'function') {
58
- valueStr = '[Function]';
59
- }
60
- else if (value === null) {
61
- valueStr = 'null';
62
- }
63
- else if (value === undefined) {
64
- valueStr = 'undefined';
65
- }
66
- else if (typeof value === 'symbol') {
67
- valueStr = `[Symbol: ${String(value)}]`;
68
- }
69
- else {
70
- valueStr = JSON.stringify(value);
71
- }
72
- }
73
- catch {
74
- valueStr = String(value);
75
- }
76
- SetExceptionMessage(exception, `Expected object but received ${actualType}: ${valueStr.slice(0, MAX_VALUE_DISPLAY_LENGTH)}`);
54
+ const valueStr = safeDisplay(value);
55
+ SetExceptionMessage(exception, `Expected object but received ${actualType}: ${valueStr}`);
77
56
  ThrowException(exception);
78
57
  }
79
58
  }
@@ -109,8 +88,8 @@ export function AssertObject(value, exception = {}) {
109
88
  * ```
110
89
  */
111
90
  export function AssertObjectHasProperty(value, property, exception = {}) {
112
- // First check if value is an object, using ObjectError
113
- AssertObject(value, { class: ObjectError });
91
+ // First check if value is an object, using the configured exception class or ObjectError
92
+ AssertObject(value, { class: exception?.class ?? ObjectError });
114
93
  // Then check for property existence, using the configured exception class or default
115
94
  SetExceptionClass(exception, ObjectPropertyError);
116
95
  if (!(property in value)) {
@@ -149,8 +128,8 @@ export function AssertObjectHasProperty(value, property, exception = {}) {
149
128
  * ```
150
129
  */
151
130
  export function AssertObjectHasOwnProperty(value, property, exception = {}) {
152
- // First check if value is an object, using ObjectError
153
- AssertObject(value, { class: ObjectError });
131
+ // First check if value is an object, using the configured exception class or ObjectError
132
+ AssertObject(value, { class: exception?.class ?? ObjectError });
154
133
  // Then check for own property existence, using the configured exception class or default
155
134
  SetExceptionClass(exception, ObjectPropertyError);
156
135
  if (!Object.hasOwn(value, property)) {
@@ -198,4 +177,3 @@ export function AssertObjectPropertyNotNull(value, property, exception = {}) {
198
177
  ThrowException(exception);
199
178
  }
200
179
  }
201
- //# sourceMappingURL=assert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../src/object/clone.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CA6DxE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,EAC5E,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9C,OAAO,CAMT"}
1
+ {"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../src/object/clone.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAkExE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,EAC5E,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9C,OAAO,CAMT"}
@@ -1,4 +1,4 @@
1
- import { filterDangerousKeys } from './security-utils.js';
1
+ import { FilterDangerousKeys } from './security-utils.js';
2
2
  /**
3
3
  * Creates a deep clone of an object with security protections.
4
4
  *
@@ -37,6 +37,10 @@ export function ObjectClone(obj, visitedInput) {
37
37
  // Mark this object as visited
38
38
  visited.add(obj);
39
39
  }
40
+ // PERFORMANCE NOTE: The backtrack pattern (visited.delete() after processing composite types)
41
+ // uses delete/add operations on WeakSet for each Date, Array, and Object. For deeply nested
42
+ // structures (100+ levels), this delete/add cost accumulates. Depth tracking would optimize
43
+ // this, but the current implementation is correct for circular reference handling.
40
44
  // Handle Date
41
45
  if (obj instanceof Date) {
42
46
  const result = new Date(obj.getTime());
@@ -52,9 +56,9 @@ export function ObjectClone(obj, visitedInput) {
52
56
  return result;
53
57
  }
54
58
  // Handle plain objects only
55
- if (obj.constructor === Object) {
59
+ if (obj.constructor === Object || Object.getPrototypeOf(obj) === null) {
56
60
  // Security: Filter out dangerous keys
57
- const safeObj = filterDangerousKeys(obj);
61
+ const safeObj = FilterDangerousKeys(obj);
58
62
  const copy = {};
59
63
  // Object.keys() returns only own enumerable properties — no further guard needed.
60
64
  for (const key of Object.keys(safeObj)) {
@@ -72,7 +76,7 @@ export function ObjectClone(obj, visitedInput) {
72
76
  }
73
77
  // Provide detailed error message for unsupported types
74
78
  const typeName = typeof obj === 'object'
75
- ? obj.constructor.name
79
+ ? Object.getPrototypeOf(obj)?.constructor?.name ?? 'Object'
76
80
  : typeof obj;
77
81
  throw new Error(`ObjectClone: ${typeName} objects are not supported. Create a new ${typeName} instance manually.`);
78
82
  }
@@ -105,4 +109,3 @@ export function TransformObject(obj, transformer) {
105
109
  }
106
110
  return transformer(obj);
107
111
  }
108
- //# sourceMappingURL=clone.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"equals.d.ts","sourceRoot":"","sources":["../../src/object/equals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAuE5D"}
1
+ {"version":3,"file":"equals.d.ts","sourceRoot":"","sources":["../../src/object/equals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAqE5D"}
@@ -48,18 +48,13 @@ export function ObjectEquals(a, b) {
48
48
  if (typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b)) {
49
49
  return true;
50
50
  }
51
- // If either value is null, undefined, or not an object, they can't be equivalent
51
+ // Null/undefined guards all subsequent branches assume non-null objects.
52
52
  if (a === null || b === null || a === undefined || b === undefined)
53
53
  return false;
54
54
  if (typeof a !== typeof b)
55
55
  return false;
56
56
  if (typeof a !== 'object')
57
57
  return false;
58
- // Type guards for object types after typeof check
59
- if (a === null || b === null)
60
- return false;
61
- if (a === undefined || b === undefined)
62
- return false;
63
58
  const aObj = a;
64
59
  const bObj = b;
65
60
  // Handle Date objects
@@ -92,6 +87,8 @@ export function ObjectEquals(a, b) {
92
87
  // Also compare symbol properties
93
88
  const symbolsA = Object.getOwnPropertySymbols(aObj);
94
89
  const symbolsB = Object.getOwnPropertySymbols(bObj);
90
+ // Early exit if neither object has symbols — REMOVED: this skips property value comparison
91
+ // if (symbolsA.length === 0 && symbolsB.length === 0) return true;
95
92
  if (symbolsA.length !== symbolsB.length)
96
93
  return false;
97
94
  for (const key of keysA) {
@@ -108,4 +105,3 @@ export function ObjectEquals(a, b) {
108
105
  }
109
106
  return true;
110
107
  }
111
- //# sourceMappingURL=equals.js.map
@@ -0,0 +1,44 @@
1
+ import type { ICachedObjectFilterOptions, TCachedObjectFilterFunction } from './types.js';
2
+ /**
3
+ * Creates a cached version of {@link ObjectFilter} for improved performance
4
+ * when filtering the same objects repeatedly.
5
+ *
6
+ * Results are cached by hashing the filter and object together. When the cache
7
+ * exceeds `maxCacheSize`, approximately 20% of the entries in the largest
8
+ * per-filter bucket are evicted.
9
+ *
10
+ * @template T - The object type being filtered
11
+ * @param options - Configuration for both the cache and the underlying filter
12
+ * @returns A cached filter function `(cursor, filter) => Promise<boolean>`
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const cachedFilter = ObjectFilterCached<User>({ maxCacheSize: 500 });
17
+ * const isAdmin = await cachedFilter(user, { role: 'admin' });
18
+ * ```
19
+ */
20
+ /**
21
+ * Creates a cached version of {@link ObjectFilter} for improved performance
22
+ * when filtering the same objects repeatedly.
23
+ *
24
+ * Results are cached by hashing the filter and object together. When the cache
25
+ * exceeds `maxCacheSize`, approximately 20% of the entries in the largest
26
+ * per-filter bucket are evicted.
27
+ *
28
+ * @template T — The object type being filtered
29
+ * @param options — Configuration for both the cache and the underlying filter
30
+ * @returns — A cached filter function `(cursor, filter) => Promise<boolean>` that returns
31
+ * `true` if the object matches the filter criteria, or `false` if it does not. An empty
32
+ * filter argument (no properties) matches all objects.
33
+ * @warning Filter objects with function-valued properties are not safely cacheable because
34
+ * {@link ObjectHash} cannot deterministically hash function references. Two different function
35
+ * instances with identical behavior will hash to different values, bypassing the cache and
36
+ * potentially causing unexpected behavior. Avoid passing filters with methods or callbacks.
37
+ * @example
38
+ * ```typescript
39
+ * const cachedFilter = ObjectFilterCached<User>({ maxCacheSize: 500 });
40
+ * const isAdmin = await cachedFilter(user, { role: 'admin' });
41
+ * ```
42
+ */
43
+ export declare function ObjectFilterCached<T extends object>(options?: ICachedObjectFilterOptions): TCachedObjectFilterFunction<T>;
44
+ //# sourceMappingURL=filter-cached.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-cached.d.ts","sourceRoot":"","sources":["../../src/object/filter-cached.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,2BAA2B,EAAwB,MAAM,YAAY,CAAC;AAMhH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,GAAE,0BAA+B,GAAG,2BAA2B,CAAC,CAAC,CAAC,CAkH7H"}
1
+ {"version":3,"file":"filter-cached.d.ts","sourceRoot":"","sources":["../../src/object/filter-cached.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,2BAA2B,EAAwB,MAAM,YAAY,CAAC;AAMhH;;;;;;;;;;;;;;;;;GAiBG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,GAAE,0BAA+B,GAAG,2BAA2B,CAAC,CAAC,CAAC,CAmI7H"}
@@ -21,6 +21,29 @@ const CACHE_EVICTION_PERCENTAGE = 0.2; // 20%
21
21
  * const isAdmin = await cachedFilter(user, { role: 'admin' });
22
22
  * ```
23
23
  */
24
+ /**
25
+ * Creates a cached version of {@link ObjectFilter} for improved performance
26
+ * when filtering the same objects repeatedly.
27
+ *
28
+ * Results are cached by hashing the filter and object together. When the cache
29
+ * exceeds `maxCacheSize`, approximately 20% of the entries in the largest
30
+ * per-filter bucket are evicted.
31
+ *
32
+ * @template T — The object type being filtered
33
+ * @param options — Configuration for both the cache and the underlying filter
34
+ * @returns — A cached filter function `(cursor, filter) => Promise<boolean>` that returns
35
+ * `true` if the object matches the filter criteria, or `false` if it does not. An empty
36
+ * filter argument (no properties) matches all objects.
37
+ * @warning Filter objects with function-valued properties are not safely cacheable because
38
+ * {@link ObjectHash} cannot deterministically hash function references. Two different function
39
+ * instances with identical behavior will hash to different values, bypassing the cache and
40
+ * potentially causing unexpected behavior. Avoid passing filters with methods or callbacks.
41
+ * @example
42
+ * ```typescript
43
+ * const cachedFilter = ObjectFilterCached<User>({ maxCacheSize: 500 });
44
+ * const isAdmin = await cachedFilter(user, { role: 'admin' });
45
+ * ```
46
+ */
24
47
  export function ObjectFilterCached(options = {}) {
25
48
  const { maxCacheSize = DEFAULT_MAX_CACHE_SIZE, useDeepEqual = false, caseInsensitiveStrings = false, validatePaths = true, } = options;
26
49
  const cache = new Map();
@@ -31,6 +54,11 @@ export function ObjectFilterCached(options = {}) {
31
54
  *
32
55
  * The eviction strategy targets the most-populated bucket to reclaim the most
33
56
  * memory in a single pass while preserving results for other active filters.
57
+ *
58
+ * PERFORMANCE NOTE: For distributed filter load, eviction triggers too frequently.
59
+ * A true global LRU across all filters would be more efficient but would require
60
+ * tracking access order globally. Refactoring to use the library's own LRUCache
61
+ * (if available) instead of per-filter Maps would improve this further.
34
62
  */
35
63
  const clearOldestEntries = () => {
36
64
  if (cache.size === 0)
@@ -47,6 +75,8 @@ export function ObjectFilterCached(options = {}) {
47
75
  }
48
76
  }
49
77
  if (largestCache) {
78
+ // Capture the original bucket size before eviction
79
+ const originalBucketSize = largestCache.size;
50
80
  // Remove approximately 20% of entries from the largest cache
51
81
  const entriesToRemove = Math.ceil(largestSize * CACHE_EVICTION_PERCENTAGE);
52
82
  let removed = 0;
@@ -59,8 +89,18 @@ export function ObjectFilterCached(options = {}) {
59
89
  // If the cache is now empty, remove it completely
60
90
  if (largestCache.size === 0) {
61
91
  cache.delete(largestCacheKey);
92
+ // Account for all entries that were in the bucket (not just the ones we explicitly removed)
93
+ totalCachedEntries -= originalBucketSize;
62
94
  }
63
- totalCachedEntries -= removed;
95
+ else {
96
+ // Only remove the entries we explicitly deleted
97
+ totalCachedEntries -= removed;
98
+ }
99
+ }
100
+ // Recompute counter to eliminate drift
101
+ totalCachedEntries = 0;
102
+ for (const bucket of cache.values()) {
103
+ totalCachedEntries += bucket.size;
64
104
  }
65
105
  };
66
106
  return (cursor, filter) => {
@@ -115,4 +155,3 @@ export function ObjectFilterCached(options = {}) {
115
155
  return Promise.resolve(result);
116
156
  };
117
157
  }
118
- //# sourceMappingURL=filter-cached.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/object/filter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAiFxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAwCvH;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAiBhG"}
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/object/filter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAyFxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAyCvH;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAiBhG"}
@@ -1,5 +1,5 @@
1
1
  import { ObjectEquals } from './equals.js';
2
- import { isPropertyPathSafe } from './security-utils.js';
2
+ import { IsPropertyPathSafe } from './security-utils.js';
3
3
  import { ObjectGetPropertyByPath } from './property-paths.js';
4
4
  import { StringEquals } from '../string/comparison.js';
5
5
  /**
@@ -60,6 +60,14 @@ function objectHandleArrayComparison(objValue, filterValue, caseInsensitiveStrin
60
60
  }
61
61
  // If filterValue is also an array, check if it's a subset
62
62
  if (Array.isArray(filterValue)) {
63
+ // PERFORMANCE: For arrays of primitives without deep equality or case-insensitive matching,
64
+ // use a Set-based approach for O(n+m) performance instead of nested loops.
65
+ if (!useDeepEqual && !caseInsensitiveStrings && filterValue.every((item) => typeof item !== 'object' || item === null)) {
66
+ const objSet = new Set(objValue);
67
+ return filterValue.every((item) => objSet.has(item));
68
+ }
69
+ // For object arrays or when deep equality is enabled, fall back to nested loop comparison
70
+ // (reference equality for objects, deep equality if requested)
63
71
  return filterValue.every((item) => objValue.some((objItem) => compareValuesForFilter(objItem, item, caseInsensitiveStrings, useDeepEqual)));
64
72
  }
65
73
  // For non-string, non-array filter values, check direct inclusion
@@ -134,12 +142,12 @@ export function ObjectFilter(object, filter, options = {}) {
134
142
  // Default options
135
143
  const { useDeepEqual = false, caseInsensitiveStrings = false, validatePaths = false } = options;
136
144
  for (const key in filter) {
137
- // Skip properties that are not own properties of the filter object
138
- if (!Object.hasOwn(filter, key))
145
+ if (!Object.hasOwn(filter, key)) {
139
146
  continue;
147
+ }
140
148
  // Handle dot notation paths
141
149
  if (key.includes('.')) {
142
- if (validatePaths && !isPropertyPathSafe(key)) {
150
+ if (validatePaths && !IsPropertyPathSafe(key)) {
143
151
  return false;
144
152
  }
145
153
  const objValue = ObjectGetPropertyByPath(object, key);
@@ -203,4 +211,3 @@ export function FilterObject(obj, predicate) {
203
211
  }
204
212
  return result;
205
213
  }
206
- //# sourceMappingURL=filter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"has-circular-reference.d.ts","sourceRoot":"","sources":["../../src/object/has-circular-reference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CA8ChE"}
1
+ {"version":3,"file":"has-circular-reference.d.ts","sourceRoot":"","sources":["../../src/object/has-circular-reference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAiDhE"}
@@ -45,10 +45,12 @@ export function ObjectHasCircularReference(obj) {
45
45
  return true;
46
46
  }
47
47
  }
48
- // Backtrack: same reason as the array case above.
48
+ // Backtrack: remove from visited set after traversal to allow the same object
49
+ // to appear via multiple non-circular paths. This correctly distinguishes shared
50
+ // references (allowed) from circular references (detected). Note: this assumes
51
+ // single-threaded synchronous traversal.
49
52
  seen.delete(value);
50
53
  return false;
51
54
  };
52
55
  return detectCircular(obj);
53
56
  }
54
- //# sourceMappingURL=has-circular-reference.js.map
@@ -1,4 +1,8 @@
1
1
  /**
2
+ * SECURITY WARNING: This hash is NON-CRYPTOGRAPHIC (cyrb53, 64-bit).
3
+ * Do NOT use for passwords, tokens, signatures, or any security-sensitive operation.
4
+ * For cryptographic hashing, use `crypto.subtle.digest('SHA-256', ...)` instead.
5
+ *
2
6
  * Creates a hash of an object.
3
7
  *
4
8
  * By default a fast, non-cryptographic 64-bit hash is used that works in all
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/object/hash.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAkBxF"}
@@ -1,4 +1,3 @@
1
- import { ObjectHasCircularReference } from './has-circular-reference.js';
2
1
  // cyrb53-style hash mixing constants (chosen for good avalanche properties)
3
2
  const HASH_SEED_1 = 0xdeadbeef;
4
3
  const HASH_SEED_2 = 0x41c6ce57;
@@ -15,6 +14,13 @@ const HEXADECIMAL_RADIX = 16;
15
14
  * Browser-compatible and synchronous — no Node.js APIs required.
16
15
  * Returns a 16-character lowercase hex string.
17
16
  */
17
+ /**
18
+ * 64-bit cyrb53 hash function.
19
+ *
20
+ * PERFORMANCE NOTE: This hash has 2^64 output space; collisions are theoretically
21
+ * possible with large datasets. For cryptographic applications requiring collision
22
+ * resistance, use crypto.subtle.digest instead.
23
+ */
18
24
  function defaultHash(data) {
19
25
  let h1 = HASH_SEED_1;
20
26
  let h2 = HASH_SEED_2;
@@ -28,6 +34,10 @@ function defaultHash(data) {
28
34
  return h1.toString(HEXADECIMAL_RADIX).padStart(HASH_PAD_WIDTH, '0') + h2.toString(HEXADECIMAL_RADIX).padStart(HASH_PAD_WIDTH, '0');
29
35
  }
30
36
  /**
37
+ * SECURITY WARNING: This hash is NON-CRYPTOGRAPHIC (cyrb53, 64-bit).
38
+ * Do NOT use for passwords, tokens, signatures, or any security-sensitive operation.
39
+ * For cryptographic hashing, use `crypto.subtle.digest('SHA-256', ...)` instead.
40
+ *
31
41
  * Creates a hash of an object.
32
42
  *
33
43
  * By default a fast, non-cryptographic 64-bit hash is used that works in all
@@ -53,16 +63,19 @@ function defaultHash(data) {
53
63
  * ```
54
64
  */
55
65
  export function ObjectHash(obj, hashFunction) {
56
- // Type guard - obj is used as-is since JSON.stringify accepts unknown
57
- // Check for circular references before attempting to stringify
58
- if (ObjectHasCircularReference(obj)) {
59
- throw new Error('Cannot hash object with circular references');
66
+ let jsonString;
67
+ try {
68
+ jsonString = JSON.stringify(obj);
69
+ }
70
+ catch (e) {
71
+ if (e instanceof TypeError && e.message.includes('circular')) {
72
+ throw new Error('Cannot hash object with circular references');
73
+ }
74
+ throw new Error('Cannot hash object: JSON.stringify failed');
60
75
  }
61
- const jsonString = JSON.stringify(obj);
62
76
  // Handle cases where JSON.stringify returns undefined
63
77
  if (jsonString === undefined) {
64
78
  throw new Error('Cannot hash object: JSON.stringify returned undefined');
65
79
  }
66
80
  return hashFunction ? hashFunction(jsonString) : defaultHash(jsonString);
67
81
  }
68
- //# sourceMappingURL=hash.js.map
@@ -23,12 +23,12 @@ export { ObjectPick } from './pick.js';
23
23
  export { ObjectOmit } from './omit.js';
24
24
  export { ObjectMerge } from './merge.js';
25
25
  export { IsObject } from './assert-object.js';
26
- export { isPropertyKeySafe, isPropertyPathSafe, sanitizePropertyKey, filterDangerousKeys, createCircularReferenceDetector, isInputSafe } from './security-utils.js';
26
+ export { IsPropertyKeySafe, IsPropertyPathSafe, SanitizePropertyKey, FilterDangerousKeys, CreateCircularReferenceDetector, IsInputSafe } from './security-utils.js';
27
27
  export { ObjectInvert } from './object-invert.js';
28
28
  export { ObjectFlatten } from './object-flatten.js';
29
29
  export { ObjectDiff } from './object-diff.js';
30
30
  export { AssertObject, ObjectError, ObjectPropertyError, AssertObjectHasProperty, AssertObjectHasOwnProperty, AssertObjectPropertyNotNull } from './assert.js';
31
31
  export type { IObjectDiffResult } from './object-diff.js';
32
- export type { TConstructableObject, TObjectOmitExtraProperties, TCachedObjectFilterFunction, TCachedObjectMapperFunction, TObjectPredicate, TObjectTransformer, TObjectComparator, TObjectEqualityComparator, TPropertyMapper, TPropertyFilter } from './types.js';
32
+ export type { TObjectOmitExtraProperties, TCachedObjectFilterFunction, TCachedObjectMapperFunction, TObjectPredicate, TObjectTransformer, TObjectComparator, TObjectEqualityComparator, TPropertyMapper, TPropertyFilter } from './types.js';
33
33
  export type { IObjectFilterOptions, ICachedObjectFilterOptions, ICachedObjectMapOptions } from './types.js';
34
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/object/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACpK,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC/J,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,YAAY,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGnQ,YAAY,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/object/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACpK,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC/J,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,YAAY,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7O,YAAY,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
@@ -24,9 +24,8 @@ export { ObjectPick } from './pick.js';
24
24
  export { ObjectOmit } from './omit.js';
25
25
  export { ObjectMerge } from './merge.js';
26
26
  export { IsObject } from './assert-object.js';
27
- export { isPropertyKeySafe, isPropertyPathSafe, sanitizePropertyKey, filterDangerousKeys, createCircularReferenceDetector, isInputSafe } from './security-utils.js';
27
+ export { IsPropertyKeySafe, IsPropertyPathSafe, SanitizePropertyKey, FilterDangerousKeys, CreateCircularReferenceDetector, IsInputSafe } from './security-utils.js';
28
28
  export { ObjectInvert } from './object-invert.js';
29
29
  export { ObjectFlatten } from './object-flatten.js';
30
30
  export { ObjectDiff } from './object-diff.js';
31
31
  export { AssertObject, ObjectError, ObjectPropertyError, AssertObjectHasProperty, AssertObjectHasOwnProperty, AssertObjectPropertyNotNull } from './assert.js';
32
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"json-circular-replacer.d.ts","sourceRoot":"","sources":["../../src/object/json-circular-replacer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,0BAA0B,CACzC,WAAW,GAAE,MAAqB,GAChC,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CA0BzD"}
1
+ {"version":3,"file":"json-circular-replacer.d.ts","sourceRoot":"","sources":["../../src/object/json-circular-replacer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,0BAA0B,CACzC,WAAW,SAAe,GACxB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CA0BzD"}
@@ -57,4 +57,3 @@ export function CreateJsonCircularReplacer(placeholder = '[Circular]') {
57
57
  return value;
58
58
  };
59
59
  }
60
- //# sourceMappingURL=json-circular-replacer.js.map
@@ -41,4 +41,3 @@ export function ObjectFromKeyValuePairs(entries) {
41
41
  export function ObjectToKeyValuePairs(obj) {
42
42
  return Object.entries(obj);
43
43
  }
44
- //# sourceMappingURL=key-value-pairs.js.map