@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
package/README.md CHANGED
@@ -1,288 +1,414 @@
1
- # TypeScript Common Utilities
1
+ # @pawells/typescript-common
2
2
 
3
- [![npm](https://img.shields.io/npm/v/@pawells/typescript-common)](https://www.npmjs.com/package/@pawells/typescript-common)
4
- [![GitHub Release](https://img.shields.io/github/v/release/PhillipAWells/typescript-common)](https://github.com/PhillipAWells/typescript-common/releases)
5
3
  [![CI](https://github.com/PhillipAWells/typescript-common/actions/workflows/ci.yml/badge.svg)](https://github.com/PhillipAWells/typescript-common/actions/workflows/ci.yml)
6
4
  [![Node](https://img.shields.io/badge/node-%3E%3D22-brightgreen)](https://nodejs.org)
5
+ [![npm version](https://img.shields.io/npm/v/@pawells/typescript-common.svg)](https://www.npmjs.com/package/@pawells/typescript-common)
7
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
8
- [![GitHub Sponsors](https://img.shields.io/github/sponsors/PhillipAWells?style=social)](https://github.com/sponsors/PhillipAWells)
9
7
 
10
- Shared TypeScript utility library. ESM-only, no runtime dependencies, targets ES2022.
8
+ ## Description
9
+
10
+ Shared TypeScript utility library providing strongly-typed, well-tested utility functions across eight domains: array, asserts, boolean, enum, function, lru-cache, object, string, and time. All functions are documented with JSDoc, fully typed, and tested to 80% coverage across all metrics.
11
+
12
+ ## Requirements
13
+
14
+ - **Node.js**: 22.0.0 or later
15
+ - **TypeScript**: 6.0.0 or later (if consuming from source)
16
+
17
+ ### Local Development
18
+
19
+ During local development, the package exports a `local` condition that resolves to TypeScript source directly without requiring a build step. This enables fast iteration when developing consuming packages.
20
+
21
+ To use the local condition in your `tsconfig.json`, ensure your resolver is configured to recognize the `@pawells/typescript-common-workspace` condition:
22
+
23
+ ```json
24
+ {
25
+ "compilerOptions": {
26
+ "moduleResolution": "bundler",
27
+ "customConditions": ["@pawells/typescript-common-workspace"]
28
+ }
29
+ }
30
+ ```
11
31
 
12
32
  ## Installation
13
33
 
34
+ Install from npm:
35
+
14
36
  ```bash
15
37
  npm install @pawells/typescript-common
16
- # or
38
+ ```
39
+
40
+ Or with yarn:
41
+
42
+ ```bash
17
43
  yarn add @pawells/typescript-common
18
44
  ```
19
45
 
20
- ## Usage
46
+ ## Quick Start
47
+
48
+ All exports are available from the main entry point or from domain-specific entry points for tree-shaking.
21
49
 
22
- All utilities are available as namespace imports or as individual named exports for tree-shaking.
50
+ ### Array Domain
23
51
 
24
52
  ```typescript
25
- // Namespace import
26
- import {
27
- ArrayUtils, BooleanUtils, NumberUtils,
28
- ObjectUtils, StringUtils, TimeUtils,
29
- EnumUtils, FunctionUtils, AssertsUtils,
30
- } from '@pawells/typescript-common';
53
+ import { ArrayChunk, ArrayFilter, ArrayShuffle, Unique } from '@pawells/typescript-common';
31
54
 
32
- ArrayUtils.ArrayChunk([1, 2, 3, 4], 2); // [[1, 2], [3, 4]]
33
- ArrayUtils.AssertArray(value); // throws if not an array
34
- ObjectUtils.IsObject(value); // returns true/false (type-guard)
35
- BooleanUtils.AssertBoolean(value); // throws if not a boolean
36
- NumberUtils.AssertNumber(value, { gte: 0, integer: true });
55
+ const items = [1, 2, 3, 4, 5];
56
+ const chunked = ArrayChunk(items, 2); // [[1, 2], [3, 4], [5]]
37
57
 
38
- // Direct named import (tree-shakeable)
39
- import { ArrayChunk, ObjectPick, KebabCase, Sleep, AssertString, LRUCache } from '@pawells/typescript-common';
40
- ```
58
+ const filtered = ArrayFilter([1, 2, 3, 4], (x) => x > 2); // [3, 4]
41
59
 
42
- ## Features & Patterns
60
+ const shuffled = ArrayShuffle([1, 2, 3]); // Random order
43
61
 
44
- ### Readonly Array Support
62
+ const unique = Unique([1, 2, 2, 3]); // [1, 2, 3]
63
+ ```
45
64
 
46
- All array utilities accept `readonly T[]` arrays, enabling zero-copy usage with frozen constants:
65
+ ### Asserts Domain
47
66
 
48
67
  ```typescript
49
- const colors = Object.freeze(['red', 'green', 'blue']); // readonly string[]
50
- ArrayChunk(colors, 2); // Works without casting!
51
- ArrayFilter(colors, c => c.length > 3); // ✓ No type errors
52
- ```
68
+ import { AssertString, AssertNumber, AssertArray } from '@pawells/typescript-common';
53
69
 
54
- ### Custom RNG for Deterministic Testing
70
+ AssertString(value); // Throws if value is not a string
71
+ AssertNumber(42); // Passes
72
+ AssertArray([1, 2, 3]); // Passes
73
+ ```
55
74
 
56
- `ArraySample` and `ArrayShuffle` accept an optional custom RNG function for reproducible randomization:
75
+ ### Boolean Domain
57
76
 
58
77
  ```typescript
59
- const seededRng = Mulberry32(42); // Your seeded PRNG
60
- ArrayShuffle([1, 2, 3], seededRng); // Same output every time
61
- ArraySample([1, 2, 3], 2, seededRng); // Deterministic sampling
78
+ import { AssertBoolean } from '@pawells/typescript-common';
62
79
 
63
- // Without RNG, defaults to Math.random() for normal usage
64
- ArrayShuffle([1, 2, 3]); // Random shuffle
80
+ AssertBoolean(true); // Passes
81
+ AssertBoolean('not a boolean'); // Throws
65
82
  ```
66
83
 
67
- ### Predicate Functions in ObjectFilter
84
+ ### Enum Domain
68
85
 
69
- Filter by predicate functions in addition to equality checks:
86
+ ```typescript
87
+ import { EnumKeys, EnumValues, ValidateEnumValue, EnumSafeValue } from '@pawells/typescript-common';
88
+
89
+ enum Color {
90
+ Red = 'RED',
91
+ Green = 'GREEN',
92
+ Blue = 'BLUE',
93
+ }
94
+
95
+ const keys = EnumKeys(Color); // ['Red', 'Green', 'Blue']
96
+ const values = EnumValues(Color); // ['RED', 'GREEN', 'BLUE']
97
+ const isValid = ValidateEnumValue(Color, 'RED'); // true
98
+ const safe = EnumSafeValue(Color, 'INVALID', Color.Red); // Color.Red
99
+ ```
100
+
101
+ ### Function Domain
70
102
 
71
103
  ```typescript
72
- const user = { name: 'John', age: 30, active: true };
73
-
74
- // Basic equality filtering
75
- ObjectFilter(user, { name: 'John' }); // true
76
-
77
- // Predicate functions as filter values
78
- ObjectFilter(user, { age: (v) => v > 18 }); // true
79
- ObjectFilter(user, { age: (v) => v < 18 }); // false
80
-
81
- // Mix predicates and values
82
- ObjectFilter(user, {
83
- active: true,
84
- age: (v) => v >= 21
85
- }); // true
86
-
87
- // Supports dot notation with predicates
88
- const order = { user: { age: 25 }, total: 100 };
89
- ObjectFilter(order, {
90
- 'user.age': (v) => v >= 21,
91
- 'total': (v) => v > 50
92
- }); // true
104
+ import { Memoize, Debounce, Throttle, Once, Compose } from '@pawells/typescript-common';
105
+
106
+ // Memoization
107
+ const expensiveCalc = Memoize((n: number) => n * n);
108
+ expensiveCalc(4); // Computed: 16
109
+ expensiveCalc(4); // Cached: 16
110
+
111
+ // Debouncing
112
+ const handleSearch = Debounce((query: string) => console.log(query), 300);
113
+ handleSearch('a');
114
+ handleSearch('ab');
115
+ handleSearch('abc'); // Only this logs after 300ms
116
+
117
+ // Throttling
118
+ const handleResize = Throttle(() => console.log('resized'), 100);
119
+
120
+ // Single execution
121
+ const initialize = Once(() => console.log('init'));
122
+ initialize(); // logs
123
+ initialize(); // no-op
124
+
125
+ // Function composition
126
+ const add = (x: number) => x + 1;
127
+ const double = (x: number) => x * 2;
128
+ const composed = Compose(double, add);
129
+ composed(5); // (5 + 1) * 2 = 12
93
130
  ```
94
131
 
95
- ## API
132
+ ### LRU Cache Domain
96
133
 
97
- ### Array utilities — `ArrayUtils`
134
+ ```typescript
135
+ import { LRUCache } from '@pawells/typescript-common';
98
136
 
99
- | Export | Description |
100
- |--------|-------------|
101
- | `ArrayChunk(array, size)` | Split an array into chunks of a given size |
102
- | `ArrayContains(array, predicate)` | Check if any element satisfies a predicate |
103
- | `ArrayFilter(array, predicate)` | Type-safe array filter |
104
- | `ArrayGroupBy(array, keyFn)` | Group array elements by a key function |
105
- | `ArrayIntersection(a, b)` | Return elements present in both arrays |
106
- | `ArrayShuffle(array, rng?)` | Return a shuffled copy of an array (optional custom RNG for deterministic results) |
107
- | `ArraySample(array, n?, rng?)` | Random element or `n` random elements (optional custom RNG for deterministic results) |
108
- | `Unique(array)` | Remove duplicate values |
109
- | `ArrayDifference(a, b)` | Elements in `a` not present in `b` |
110
- | `ArrayFlatten(array, depth?)` | Flatten a nested array to a given depth |
111
- | `ArrayCompact(array)` | Remove `null`/`undefined`, narrowing the type |
112
- | `ArrayPartition(array, predicate)` | Split into `[matches, rest]` |
113
- | `ArrayZip(...arrays)` | Zip multiple arrays into tuples |
114
- | `ArrayRange(start, end, step?)` | Generate a numeric sequence |
115
- | `ArraySortBy(array, keyFn, direction?)` | Immutable sort by a computed key |
116
- | `ArrayCountBy(array, keyFn)` | Count elements per group key |
117
- | `AssertArray(value, args?, exception?)` | Assert value is an array (with optional size constraints) |
118
- | `AssertArray2D(value, args?, exception?)` | Assert value is a rectangular 2D array |
119
- | `AssertArrayNotEmpty(value, exception?)` | Assert array has at least one element |
120
- | `AssertArrayAll(array, predicate, exception?)` | Assert every element satisfies a predicate |
121
- | `AssertArrayAny(array, predicate, exception?)` | Assert at least one element satisfies a predicate |
122
-
123
- ### Boolean utilities — `BooleanUtils`
124
-
125
- | Export | Description |
126
- |--------|-------------|
127
- | `AssertBoolean(value, exception?)` | Assert value is a boolean primitive |
137
+ const cache = new LRUCache<string, number>(2);
138
+ cache.set('a', 1);
139
+ cache.set('b', 2);
140
+ cache.set('c', 3); // Evicts 'a' (least recently used)
128
141
 
129
- ### Number utilities — `NumberUtils`
142
+ console.log(cache.get('a')); // undefined
143
+ console.log(cache.get('b')); // 2
144
+ ```
130
145
 
131
- | Export | Description |
132
- |--------|-------------|
133
- | `AssertNumber(value, args?, exception?)` | Assert value is a number with optional range/type constraints (`finite`, `integer`, `gt`, `gte`, `lt`, `lte`, `eq`) |
146
+ ### Number Domain
134
147
 
135
- ### Object utilities — `ObjectUtils`
148
+ ```typescript
149
+ import { AssertNumber, AssertFinite } from '@pawells/typescript-common';
136
150
 
137
- | Export | Description |
138
- |--------|-------------|
139
- | `IsObject(value)` | Type-guard: returns `true` if value is a non-null, non-array object |
140
- | `ObjectClone(obj)` | Deep-clone an object |
141
- | `ObjectEquals(a, b)` | Deep equality check |
142
- | `ObjectFilter(obj, filter, options?)` | Filter object by property values or predicate functions (supports dot notation, deep equality, case-insensitive matching, and predicate functions) |
143
- | `ObjectFilterCached(options?)` | Returns a cached filter function for repeated filtering operations with optional deep equality and case-insensitive matching |
144
- | `FilterObject(obj, keys)` | Keep only specified keys |
145
- | `ObjectPick(obj, keys)` | Pick a subset of keys |
146
- | `ObjectOmit(obj, keys)` | Omit specified keys |
147
- | `ObjectMerge(target, ...sources)` | Deep merge objects |
148
- | `MapObject(obj, fn)` | Map over object values |
149
- | `MapObjectCached(options?)` | Returns a cached map function for repeated mapping operations with optional async support |
150
- | `TransformObject(obj, fn)` | Transform object entries |
151
- | `ObjectHash(obj)` | Compute a stable hash of an object |
152
- | `ObjectSortKeys(obj)` | Return object with keys sorted |
153
- | `ObjectFromKeyValuePairs(pairs)` | Build an object from `[key, value]` pairs |
154
- | `ObjectToKeyValuePairs(obj)` | Convert an object to `[key, value]` pairs |
155
- | `ObjectGetPropertyByPath(obj, path)` | Get a nested property by dot-path |
156
- | `ObjectSetPropertyByPath(obj, path, value)` | Set a nested property by dot-path |
157
- | `ObjectInvert(obj)` | Swap keys and values |
158
- | `ObjectFlatten(obj, separator?)` | Flatten nested object to dot-separated keys |
159
- | `ObjectDiff(objA, objB)` | Compute added/removed/changed keys between two objects |
160
- | `ObjectHasCircularReference(obj)` | Detect circular references in an object |
161
- | `CreateJsonCircularReplacer(placeholder?)` | Create a `JSON.stringify` replacer that handles circular refs |
162
- | `AssertObject(value, exception?)` | Assert value is a plain object (not null, array, or function), narrowing to `Record<string, unknown>` |
163
- | `AssertObjectHasProperty(value, property, exception?)` | Assert object has an inherited or own property |
164
- | `AssertObjectHasOwnProperty(value, property, exception?)` | Assert object has a direct own property |
165
- | `AssertObjectPropertyNotNull(value, property, exception?)` | Assert object property is not null/undefined |
166
-
167
- ### String utilities — `StringUtils`
168
-
169
- | Export | Description |
170
- |--------|-------------|
171
- | `CamelCase(str)` | Convert a string to camelCase |
172
- | `Capitalize(str)` | Capitalize the first letter of a string |
173
- | `PascalCase(str)` | Convert a string to PascalCase |
174
- | `KebabCase(str)` | Convert a string to kebab-case |
175
- | `SnakeCase(str)` | Convert a string to snake_case |
176
- | `ScreamingSnakeCase(str)` | Convert a string to SCREAMING_SNAKE_CASE |
177
- | `FormatString(template, values)` | Simple string template formatting |
178
- | `TruncateString(str, maxLength, ellipsis?)` | Truncate a string with ellipsis |
179
- | `PadString(str, length, char?, padEnd?)` | Pad a string to a specified length |
180
- | `EscapeHTML(str)` | Escape HTML special characters |
181
- | `StripHTML(str)` | Remove all HTML tags from a string |
182
- | `Pluralize(word, count, plural?)` | Return singular or plural form based on count |
183
- | `WordCount(str)` | Count the number of words in a string |
184
- | `CountOccurrences(str, substr)` | Count non-overlapping occurrences of a substring |
185
- | `ReverseString(str)` | Reverse a string |
186
- | `Slugify(str)` | Convert a string to a URL-friendly slug |
187
- | `IsBlankString(str)` | Check if a string is empty or whitespace-only |
188
- | `IsHexString(str)` | Check if a string is a valid hexadecimal value |
189
- | `StringEquals(a, b, caseInsensitive?)` | Compare two strings with optional case-insensitive matching |
190
- | `AssertString(value, exception?)` | Assert value is a string primitive |
191
- | `AssertStringNotEmpty(value, exception?)` | Assert value is a non-empty, non-whitespace string |
192
- | `AssertStringMatches(value, regex, exception?)` | Assert string matches a regular expression |
193
-
194
- ### Time utilities — `TimeUtils`
195
-
196
- | Export | Description |
197
- |--------|-------------|
198
- | `ElapsedTime` | Class for measuring elapsed time with human-readable output |
199
- | `FormatElapsedTime(ms, options?)` | Format milliseconds using concise format |
200
- | `Stopwatch` | Lap-based stopwatch for benchmarking |
151
+ AssertNumber(42); // Passes
152
+ AssertNumber('not a number'); // Throws
153
+ ```
201
154
 
202
- ### Enum utilities — `EnumUtils`
155
+ ### Object Domain
203
156
 
204
- | Export | Description |
205
- |--------|-------------|
206
- | `EnumKeys(enumObj)` | Get keys of a TypeScript enum |
207
- | `EnumValues(enumObj)` | Get values of a TypeScript enum |
208
- | `EnumEntries(enumObj)` | Get key-value pairs of a TypeScript enum |
209
- | `ValidateEnumValue(enumObj, value)` | Check if a value is a valid enum member |
210
- | `EnumKeyByValue(enumObj, value)` | Look up an enum key by its value |
211
- | `EnumSafeValue(enumObj, value)` | Return the value if valid, or `undefined` |
157
+ ```typescript
158
+ import {
159
+ ObjectClone,
160
+ ObjectEquals,
161
+ ObjectFilter,
162
+ ObjectPick,
163
+ ObjectOmit,
164
+ ObjectMerge,
165
+ ObjectHash,
166
+ } from '@pawells/typescript-common';
212
167
 
213
- ### Function utilities `FunctionUtils`
168
+ const original = { a: 1, b: { c: 2 } };
169
+ const cloned = ObjectClone(original);
214
170
 
215
- | Export | Description |
216
- |--------|-------------|
217
- | `Debounce(fn, ms)` | Delay execution until `ms` ms after the last call |
218
- | `Throttle(fn, ms)` | Limit execution to at most once per `ms` ms |
219
- | `Memoize(fn, keyFn?)` | Cache results by serialised arguments |
220
- | `Once(fn)` | Execute a function at most once, caching the result |
221
- | `Pipe(...fns)` | Compose functions left-to-right |
222
- | `Compose(...fns)` | Compose functions right-to-left |
223
- | `Sleep(ms)` | Return a `Promise` that resolves after `ms` ms |
171
+ const obj1 = { x: 1 };
172
+ const obj2 = { x: 1 };
173
+ console.log(ObjectEquals(obj1, obj2)); // true
224
174
 
225
- ### LRU Cache `LRUCache`
175
+ const filtered = ObjectFilter({ a: 1, b: 2, c: 3 }, (v) => v > 1); // { b: 2, c: 3 }
226
176
 
227
- | Export | Description |
228
- |--------|-------------|
229
- | `LRUCache<K, V>` | Generic Least Recently Used cache with configurable capacity |
177
+ const picked = ObjectPick({ a: 1, b: 2, c: 3 }, ['a', 'b']); // { a: 1, b: 2 }
178
+
179
+ const omitted = ObjectOmit({ a: 1, b: 2, c: 3 }, ['c']); // { a: 1, b: 2 }
180
+
181
+ const merged = ObjectMerge({ a: 1 }, { b: 2 }); // { a: 1, b: 2 }
182
+
183
+ const hash = ObjectHash({ a: 1, b: 2 }); // 'e4f3...'
184
+ ```
185
+
186
+ ### String Domain
230
187
 
231
188
  ```typescript
232
- const cache = new LRUCache<string, number>(100);
233
- cache.set('key', 42);
234
- cache.get('key'); // 42 (marks as recently used)
235
- cache.has('key'); // true
236
- cache.clear(); // removes all entries
189
+ import {
190
+ CamelCase,
191
+ PascalCase,
192
+ KebabCase,
193
+ SnakeCase,
194
+ EscapeHTML,
195
+ TruncateString,
196
+ StringEquals,
197
+ } from '@pawells/typescript-common';
198
+
199
+ console.log(CamelCase('hello-world')); // 'helloWorld'
200
+ console.log(PascalCase('hello-world')); // 'HelloWorld'
201
+ console.log(KebabCase('helloWorld')); // 'hello-world'
202
+ console.log(SnakeCase('helloWorld')); // 'hello_world'
203
+
204
+ console.log(EscapeHTML('<script>alert("xss")</script>')); // '&lt;script&gt;...'
205
+
206
+ console.log(TruncateString('Hello World', 8)); // 'Hello...'
207
+
208
+ console.log(StringEquals('hello', 'HELLO', true)); // true (case-insensitive)
237
209
  ```
238
210
 
239
- ### Assertion utilities — `AssertsUtils`
211
+ ### Time Domain
240
212
 
241
- Cross-cutting assertions not tied to a single type, plus the shared assertion infrastructure.
213
+ ```typescript
214
+ import { ElapsedTime, Stopwatch } from '@pawells/typescript-common';
215
+
216
+ // Elapsed time value object
217
+ const elapsed = new ElapsedTime(5000); // 5 seconds
218
+ console.log(elapsed.seconds()); // 5
219
+ console.log(elapsed.toString()); // '5.00s'
220
+
221
+ // Stopwatch for timing events
222
+ const stopwatch = new Stopwatch();
223
+ stopwatch.start();
224
+ // ... do work ...
225
+ stopwatch.stop();
226
+ console.log(stopwatch.elapsed().toString()); // Duration of work
227
+ ```
242
228
 
243
- | Export | Description |
244
- |--------|-------------|
245
- | `AssertEquals(value, expected, exception?)` | Assert two values are deeply equal |
246
- | `AssertNotEquals(value, expected, exception?)` | Assert two values are not deeply equal |
247
- | `AssertNull(value, exception?)` | Assert value is `null` or `undefined` |
248
- | `AssertNotNull(value, exception?)` | Assert value is neither `null` nor `undefined` |
249
- | `AssertPredicate(value, predicate, exception?)` | Assert a custom predicate holds |
250
- | `AssertIsType(value, typeGuard, exception?)` | Assert via a type-guard function |
251
- | `AssertInstanceOf(value, constructor, exception?)` | Assert value is an instance of a constructor |
252
- | `AssertFunction(value, exception?)` | Assert value is a function |
253
- | `AssertSymbol(value, exception?)` | Assert value is a symbol |
254
- | `AssertExtends(derived, base, exception?)` | Assert one class extends another |
255
- | `ThrowException(exception)` | Throw using an `IAssertException` config object |
256
- | `SetExceptionClass(exception, class, force?)` | Configure the error class for an assertion |
257
- | `SetExceptionMessage(exception, message, force?)` | Configure the error message for an assertion |
229
+ ## API Reference
258
230
 
259
- **All type-specific assertions** (`AssertArray`, `AssertBoolean`, `AssertNumber`, `AssertObject` (throwing), `AssertString`, etc.) are also accessible through `AssertsUtils` as a single convenience namespace.
231
+ ### Array
260
232
 
261
- **Note:** `AssertObject` is a throwing assertion available in both `ObjectUtils` and `AssertsUtils` (narrows to `Record<string, unknown>`). Use `ObjectUtils.IsObject` for a non-throwing boolean type-guard that returns `true`/`false`.
233
+ | Symbol | Description |
234
+ |--------|-------------|
235
+ | `ArrayChunk` | Splits an array into fixed-size chunks |
236
+ | `ArrayCompact` | Removes null and undefined values from an array |
237
+ | `ArrayContains` | Checks if array contains element matching predicate |
238
+ | `ArrayDifference` | Returns elements in first array but not in second |
239
+ | `ArrayFilter` | Filters array by object criteria or predicate function |
240
+ | `ArrayFlatten` | Flattens nested arrays to specified depth |
241
+ | `ArrayGroupBy` | Groups array elements by a key function |
242
+ | `ArrayIntersection` | Returns elements present in all arrays |
243
+ | `ArrayPartition` | Splits array into two based on predicate |
244
+ | `ArrayRange` | Generates array of numbers in range |
245
+ | `ArraySample` | Returns random element(s) from array |
246
+ | `ArrayShuffle` | Returns shuffled copy of array |
247
+ | `ArraySortBy` | Sorts array by key function with optional comparator |
248
+ | `ArrayCountBy` | Counts elements grouped by key function |
249
+ | `ArrayZip` | Combines multiple arrays element-wise |
250
+ | `Unique` | Returns array with duplicate elements removed |
251
+ | `TPredicate` | Type for predicate function: `(value: T) => boolean` |
252
+ | `TTransform` | Type for transform function: `(input: T) => U` |
253
+ | `TComparator` | Type for comparator: `(a: T, b: T) => number` |
254
+ | `TEqualityComparator` | Type for equality: `(a: T, b: T) => boolean` |
255
+
256
+ ### Asserts
257
+
258
+ | Symbol | Description |
259
+ |--------|-------------|
260
+ | `AssertEquals` | Asserts two values are strictly equal |
261
+ | `AssertNotEquals` | Asserts two values are not strictly equal |
262
+ | `AssertNull` | Asserts value is null |
263
+ | `AssertNotNull` | Asserts value is not null |
264
+ | `AssertPredicate` | Asserts value satisfies predicate function |
265
+ | `AssertIsType` | Asserts value is of specific type |
266
+ | `AssertInstanceOf` | Asserts value is instance of class/constructor |
267
+ | `AssertFunction` | Asserts value is a function |
268
+ | `AssertSymbol` | Asserts value is a symbol |
269
+ | `AssertExtends` | Asserts value extends interface type |
270
+ | `AssertArray` | Asserts value is an array |
271
+ | `AssertBoolean` | Asserts value is a boolean |
272
+ | `AssertNumber` | Asserts value is a number |
273
+ | `AssertFinite` | Asserts value is a finite number |
274
+ | `AssertObject` | Asserts value is a plain object |
275
+ | `AssertString` | Asserts value is a string |
276
+ | `AssertStringNotEmpty` | Asserts value is non-empty string |
277
+ | `AssertObjectHasProperty` | Asserts object has property (including inherited) |
278
+ | `AssertObjectHasOwnProperty` | Asserts object has own property |
279
+ | `NullError` | Custom error for null assertion failure |
280
+ | `NotNullError` | Custom error for not-null assertion failure |
281
+ | `PredicateError` | Custom error for predicate assertion failure |
282
+ | `TypeGuardError` | Custom error for type guard assertion failure |
283
+ | `InstanceOfError` | Custom error for instanceof assertion failure |
284
+ | `ExtendsError` | Custom error for type extends assertion failure |
285
+
286
+ ### Boolean
287
+
288
+ | Symbol | Description |
289
+ |--------|-------------|
290
+ | `AssertBoolean` | Asserts value is a boolean |
262
291
 
263
- #### Error classes
292
+ ### Enum
264
293
 
265
- `BaseError`, `ValidationError`, `AssertionError`, `InvalidArgumentError`, `NotFoundError`, `NotSupportedError`, `BufferOverflowError`, `ArrayError`, `BooleanError`, `NumberError`, `NumberRangeError`, `ObjectError`, `ObjectPropertyError`, `StringError`, `NullError`, `NotNullError`, `PredicateError`, `TypeGuardError`, `InstanceOfError`, `FunctionError`, `SymbolError`, `ExtendsError`.
294
+ | Symbol | Description |
295
+ |--------|-------------|
296
+ | `EnumKeys` | Returns array of enum keys |
297
+ | `EnumValues` | Returns array of enum values |
298
+ | `EnumEntries` | Returns array of [key, value] tuples |
299
+ | `EnumKeyByValue` | Looks up enum key by value |
300
+ | `ValidateEnumValue` | Checks if value is valid enum member |
301
+ | `EnumSafeValue` | Returns value if valid enum member, else fallback |
266
302
 
267
- ## Development
303
+ ### Function
268
304
 
269
- ```bash
270
- yarn install # Install dependencies
271
- yarn build # Compile TypeScript (tsconfig.build.json) ./build/
272
- yarn dev # Build + run
273
- yarn watch # Watch mode
274
- yarn typecheck # Type check without building
275
- yarn lint # ESLint
276
- yarn lint:fix # ESLint with auto-fix
277
- yarn test # Run tests
278
- yarn test:ui # Interactive Vitest UI
279
- yarn test:coverage # Tests with coverage report
280
- ```
305
+ | Symbol | Description |
306
+ |--------|-------------|
307
+ | `Debounce` | Delays function execution until after time period with no calls |
308
+ | `Throttle` | Limits function execution to at most once per time period |
309
+ | `Memoize` | Caches function results by serialized arguments (LRU eviction) |
310
+ | `Once` | Returns wrapper that executes function at most once |
311
+ | `Compose` | Creates right-to-left function composition |
312
+ | `Sleep` | Returns promise that resolves after delay |
313
+
314
+ > **⚠️ Security Warning — Memoize**
315
+ >
316
+ > Do not memoize functions with sensitive parameters (passwords, tokens, API keys). The cache stores return values keyed by serialized arguments, which could expose sensitive data if the cache is inspected or if the key function inadvertently includes sensitive data.
317
+ >
318
+ > For functions handling sensitive data, consider:
319
+ > - Not memoizing at all
320
+ > - Using a custom key function that excludes sensitive parameters
321
+ > - Implementing manual cache invalidation after processing sensitive data
322
+ >
323
+ > See JSDoc `@warning` in source for full details.
324
+
325
+ ### LRU Cache
326
+
327
+ | Symbol | Description |
328
+ |--------|-------------|
329
+ | `LRUCache` | Generic Least Recently Used cache with fixed capacity |
330
+
331
+ > **⚠️ Security Warning — LRU Cache**
332
+ >
333
+ > Do not cache sensitive objects (API keys, tokens, passwords, PII). Cache entries remain in memory until evicted or cleared. If the cache is inspected (via debugger, memory dump, or compromised process), sensitive values will be exposed.
334
+ >
335
+ > For sensitive data, prefer:
336
+ > - Ephemeral processing without caching
337
+ > - Implementing automatic expiration
338
+ > - Secure clearing (e.g., overwrite before eviction)
339
+ >
340
+ > See JSDoc `@warning` in source for full details.
341
+
342
+ ### Number
343
+
344
+ | Symbol | Description |
345
+ |--------|-------------|
346
+ | `AssertNumber` | Asserts value is a number |
347
+ | `AssertFinite` | Asserts value is a finite number |
281
348
 
282
- ## Requirements
349
+ ### Object
283
350
 
284
- - Node.js >= 22.0.0
351
+ | Symbol | Description |
352
+ |--------|-------------|
353
+ | `ObjectClone` | Deep clones object with circular reference detection |
354
+ | `TransformObject` | Transforms object using visitor pattern |
355
+ | `ObjectEquals` | Deep equality comparison for objects |
356
+ | `ObjectFilter` | Filters object properties by predicate |
357
+ | `FilterObject` | Variant of ObjectFilter |
358
+ | `ObjectFilterCached` | Filters object with caching |
359
+ | `MapObject` | Maps object values by transform function |
360
+ | `MapObjectCached` | Maps object with caching |
361
+ | `ObjectHash` | Generates hash for object |
362
+ | `ObjectGetPropertyByPath` | Gets property value by dot-notation path |
363
+ | `ObjectSetPropertyByPath` | Sets property value by dot-notation path |
364
+ | `ObjectSortKeys` | Returns object with keys sorted |
365
+ | `ObjectFromKeyValuePairs` | Creates object from [key, value] tuples |
366
+ | `ObjectToKeyValuePairs` | Converts object to [key, value] tuples |
367
+ | `ObjectPick` | Returns new object with selected keys |
368
+ | `ObjectOmit` | Returns new object without selected keys |
369
+ | `ObjectMerge` | Shallowly merges objects |
370
+ | `IsObject` | Type guard for plain objects |
371
+ | `ObjectInvert` | Inverts object keys and values |
372
+ | `ObjectFlatten` | Flattens nested object to dot-notation keys |
373
+ | `ObjectDiff` | Computes differences between two objects |
374
+ | `ObjectHasCircularReference` | Detects circular references |
375
+ | `CreateJsonCircularReplacer` | Creates replacer for JSON.stringify with circular refs |
376
+ | `IsPropertyKeySafe` | Checks if property key is safe (not prototype-pollution) |
377
+ | `IsPropertyPathSafe` | Checks if property path is safe |
378
+ | `SanitizePropertyKey` | Removes dangerous characters from key |
379
+ | `FilterDangerousKeys` | Filters dangerous keys from object |
380
+ | `CreateCircularReferenceDetector` | Creates detector for circular references |
381
+ | `IsInputSafe` | Comprehensive input safety check |
382
+
383
+ ### String
384
+
385
+ | Symbol | Description |
386
+ |--------|-------------|
387
+ | `CamelCase` | Converts string to camelCase |
388
+ | `PascalCase` | Converts string to PascalCase |
389
+ | `KebabCase` | Converts string to kebab-case |
390
+ | `SnakeCase` | Converts string to snake_case |
391
+ | `EscapeHTML` | Escapes HTML special characters |
392
+ | `StripHTML` | Removes HTML tags from string |
393
+ | `FormatString` | Formats string using template parameters |
394
+ | `TruncateString` | Truncates string to max length with ellipsis |
395
+ | `PadString` | Pads string to length with character |
396
+ | `Pluralize` | Returns plural form based on count |
397
+ | `WordCount` | Counts words in string |
398
+ | `CountOccurrences` | Counts occurrences of substring |
399
+ | `StringEquals` | Case-sensitive or case-insensitive equality |
400
+ | `IsEmpty` | Checks if string is empty or whitespace only |
401
+ | `AssertString` | Asserts value is a string |
402
+ | `AssertStringNotEmpty` | Asserts value is non-empty string |
403
+
404
+ ### Time
405
+
406
+ | Symbol | Description |
407
+ |--------|-------------|
408
+ | `ElapsedTime` | Value object representing duration in milliseconds |
409
+ | `Stopwatch` | Utility for recording timestamped events and intervals |
410
+ | `StopwatchEntry` | Represents single stopwatch event (start, stop, lap, etc.) |
285
411
 
286
412
  ## License
287
413
 
288
- MIT — See [LICENSE](./LICENSE) for details.
414
+ MIT — See [LICENSE](../../LICENSE) for details.
@@ -4,7 +4,7 @@
4
4
  * @template T - The type of array elements
5
5
  * @param array - The array to split
6
6
  * @param size - Size of each chunk (last chunk may be smaller)
7
- * @returns Array of arrays, each of the specified size
7
+ * @returns Array of arrays, each of the specified size. Returns `[]` if `array` is `null`, `undefined`, or `size` is not positive.
8
8
  *
9
9
  * @example
10
10
  * ```typescript