@pawells/typescript-common 1.4.1 → 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 (428) hide show
  1. package/README.md +350 -223
  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 +4 -1
  7. package/{build → dist}/array/array-contains.d.ts.map +1 -1
  8. package/{build → dist}/array/array-contains.js +6 -3
  9. package/{build → dist}/array/array-count-by.d.ts +3 -1
  10. package/dist/array/array-count-by.d.ts.map +1 -0
  11. package/{build → dist}/array/array-count-by.js +4 -2
  12. package/dist/array/array-difference.d.ts +43 -0
  13. package/dist/array/array-difference.d.ts.map +1 -0
  14. package/dist/array/array-difference.js +70 -0
  15. package/dist/array/array-element.js +1 -0
  16. package/{build → dist}/array/array-filter.d.ts +3 -1
  17. package/{build → dist}/array/array-filter.d.ts.map +1 -1
  18. package/{build → dist}/array/array-filter.js +5 -3
  19. package/{build → dist}/array/array-flatten.d.ts +2 -2
  20. package/{build → dist}/array/array-flatten.d.ts.map +1 -1
  21. package/{build → dist}/array/array-flatten.js +1 -2
  22. package/{build → dist}/array/array-group-by.d.ts +3 -1
  23. package/dist/array/array-group-by.d.ts.map +1 -0
  24. package/{build → dist}/array/array-group-by.js +12 -8
  25. package/dist/array/array-intersection.d.ts +43 -0
  26. package/dist/array/array-intersection.d.ts.map +1 -0
  27. package/dist/array/array-intersection.js +79 -0
  28. package/{build → dist}/array/array-partition.d.ts +3 -1
  29. package/{build → dist}/array/array-partition.d.ts.map +1 -1
  30. package/{build → dist}/array/array-partition.js +4 -2
  31. package/{build → dist}/array/array-range.d.ts +1 -1
  32. package/{build → dist}/array/array-range.js +1 -2
  33. package/{build → dist}/array/array-sample.d.ts +4 -4
  34. package/dist/array/array-sample.d.ts.map +1 -0
  35. package/{build → dist}/array/array-sample.js +4 -14
  36. package/{build → dist}/array/array-shuffle.d.ts +1 -1
  37. package/{build → dist}/array/array-shuffle.js +1 -2
  38. package/{build → dist}/array/array-sort-by.d.ts +1 -1
  39. package/{build → dist}/array/array-sort-by.js +1 -2
  40. package/{build → dist}/array/array-zip.d.ts +1 -1
  41. package/{build → dist}/array/array-zip.js +1 -2
  42. package/{build → dist}/array/assert.d.ts +27 -23
  43. package/dist/array/assert.d.ts.map +1 -0
  44. package/{build → dist}/array/assert.js +40 -37
  45. package/{build → dist}/array/index.js +0 -1
  46. package/{build → dist}/array/types.d.ts +29 -0
  47. package/dist/array/types.d.ts.map +1 -0
  48. package/dist/array/types.js +1 -0
  49. package/{build → dist}/array/unique.d.ts +3 -1
  50. package/{build → dist}/array/unique.d.ts.map +1 -1
  51. package/{build → dist}/array/unique.js +5 -3
  52. package/dist/asserts/errors.d.ts.map +1 -0
  53. package/{build → dist}/asserts/errors.js +5 -3
  54. package/{build → dist}/asserts/generic.d.ts +32 -3
  55. package/dist/asserts/generic.d.ts.map +1 -0
  56. package/{build → dist}/asserts/generic.js +63 -15
  57. package/dist/asserts/index.d.ts +47 -0
  58. package/dist/asserts/index.d.ts.map +1 -0
  59. package/dist/asserts/index.js +46 -0
  60. package/{build → dist}/asserts/internal-utils.d.ts.map +1 -1
  61. package/{build → dist}/asserts/internal-utils.js +0 -1
  62. package/{build → dist}/asserts/types.d.ts +56 -17
  63. package/dist/asserts/types.d.ts.map +1 -0
  64. package/dist/asserts/types.js +1 -0
  65. package/{build → dist}/asserts/utils.d.ts +18 -2
  66. package/dist/asserts/utils.d.ts.map +1 -0
  67. package/{build → dist}/asserts/utils.js +56 -1
  68. package/{build → dist}/boolean/assert.d.ts +1 -2
  69. package/{build → dist}/boolean/assert.d.ts.map +1 -1
  70. package/{build → dist}/boolean/assert.js +3 -8
  71. package/dist/boolean/index.d.ts +13 -0
  72. package/dist/boolean/index.d.ts.map +1 -0
  73. package/dist/boolean/index.js +12 -0
  74. package/{build → dist}/enum/enum-entries.d.ts +1 -1
  75. package/dist/enum/enum-entries.d.ts.map +1 -0
  76. package/{build → dist}/enum/enum-entries.js +0 -1
  77. package/{build → dist}/enum/enum-key-by-value.d.ts +1 -1
  78. package/dist/enum/enum-key-by-value.d.ts.map +1 -0
  79. package/{build → dist}/enum/enum-key-by-value.js +0 -1
  80. package/{build → dist}/enum/enum-keys.js +0 -1
  81. package/{build → dist}/enum/enum-safe-value.d.ts +1 -1
  82. package/dist/enum/enum-safe-value.d.ts.map +1 -0
  83. package/{build → dist}/enum/enum-safe-value.js +0 -1
  84. package/{build → dist}/enum/enum-values.js +0 -1
  85. package/{build → dist}/enum/index.d.ts +1 -1
  86. package/dist/enum/index.d.ts.map +1 -0
  87. package/{build → dist}/enum/index.js +1 -2
  88. package/dist/enum/types.js +1 -0
  89. package/{build → dist}/enum/validate-enum-value.d.ts +1 -1
  90. package/dist/enum/validate-enum-value.d.ts.map +1 -0
  91. package/{build → dist}/enum/validate-enum-value.js +0 -1
  92. package/{build → dist}/function/compose.d.ts +9 -2
  93. package/dist/function/compose.d.ts.map +1 -0
  94. package/{build → dist}/function/compose.js +0 -1
  95. package/{build → dist}/function/debounce.d.ts +8 -1
  96. package/dist/function/debounce.d.ts.map +1 -0
  97. package/{build → dist}/function/debounce.js +6 -1
  98. package/{build → dist}/function/index.js +0 -1
  99. package/dist/function/memoize.d.ts +43 -0
  100. package/dist/function/memoize.d.ts.map +1 -0
  101. package/dist/function/memoize.js +59 -0
  102. package/{build → dist}/function/once.d.ts +1 -0
  103. package/{build → dist}/function/once.d.ts.map +1 -1
  104. package/{build → dist}/function/once.js +2 -1
  105. package/{build → dist}/function/sleep.js +0 -1
  106. package/dist/function/throttle.d.ts +25 -0
  107. package/dist/function/throttle.d.ts.map +1 -0
  108. package/{build → dist}/function/throttle.js +7 -1
  109. package/dist/function/types.d.ts +18 -0
  110. package/dist/function/types.d.ts.map +1 -0
  111. package/dist/function/types.js +1 -0
  112. package/dist/index.d.ts +11 -0
  113. package/dist/index.d.ts.map +1 -0
  114. package/dist/index.js +10 -0
  115. package/{build → dist}/lru-cache.d.ts +19 -0
  116. package/dist/lru-cache.d.ts.map +1 -0
  117. package/{build → dist}/lru-cache.js +24 -2
  118. package/{build → dist}/number/assert.d.ts.map +1 -1
  119. package/{build → dist}/number/assert.js +38 -43
  120. package/dist/number/index.d.ts +13 -0
  121. package/dist/number/index.d.ts.map +1 -0
  122. package/dist/number/index.js +12 -0
  123. package/{build → dist}/object/assert-object.d.ts +5 -1
  124. package/{build → dist}/object/assert-object.d.ts.map +1 -1
  125. package/{build → dist}/object/assert-object.js +4 -1
  126. package/{build → dist}/object/assert.d.ts +1 -1
  127. package/dist/object/assert.d.ts.map +1 -0
  128. package/{build → dist}/object/assert.js +7 -29
  129. package/{build → dist}/object/clone.d.ts.map +1 -1
  130. package/{build → dist}/object/clone.js +11 -5
  131. package/{build → dist}/object/equals.d.ts +1 -1
  132. package/{build → dist}/object/equals.d.ts.map +1 -1
  133. package/{build → dist}/object/equals.js +12 -9
  134. package/dist/object/filter-cached.d.ts +44 -0
  135. package/{build → dist}/object/filter-cached.d.ts.map +1 -1
  136. package/{build → dist}/object/filter-cached.js +41 -2
  137. package/{build → dist}/object/filter.d.ts +1 -1
  138. package/{build → dist}/object/filter.d.ts.map +1 -1
  139. package/{build → dist}/object/filter.js +38 -70
  140. package/{build → dist}/object/has-circular-reference.d.ts.map +1 -1
  141. package/{build → dist}/object/has-circular-reference.js +4 -2
  142. package/{build → dist}/object/hash.d.ts +5 -1
  143. package/dist/object/hash.d.ts.map +1 -0
  144. package/{build → dist}/object/hash.js +20 -6
  145. package/{build → dist}/object/index.d.ts +2 -2
  146. package/{build → dist}/object/index.d.ts.map +1 -1
  147. package/{build → dist}/object/index.js +1 -2
  148. package/{build → dist}/object/json-circular-replacer.d.ts.map +1 -1
  149. package/{build → dist}/object/json-circular-replacer.js +0 -1
  150. package/{build → dist}/object/key-value-pairs.js +0 -1
  151. package/dist/object/map-cached.d.ts +31 -0
  152. package/dist/object/map-cached.d.ts.map +1 -0
  153. package/{build → dist}/object/map-cached.js +34 -6
  154. package/{build → dist}/object/map.js +0 -1
  155. package/{build → dist}/object/merge.d.ts.map +1 -1
  156. package/{build → dist}/object/merge.js +7 -7
  157. package/{build → dist}/object/object-diff.d.ts +2 -2
  158. package/{build → dist}/object/object-diff.d.ts.map +1 -1
  159. package/{build → dist}/object/object-diff.js +11 -5
  160. package/{build → dist}/object/object-flatten.d.ts +1 -1
  161. package/{build → dist}/object/object-flatten.d.ts.map +1 -1
  162. package/{build → dist}/object/object-flatten.js +6 -4
  163. package/{build → dist}/object/object-invert.js +0 -1
  164. package/{build → dist}/object/omit.js +0 -1
  165. package/{build → dist}/object/pick.js +0 -1
  166. package/{build → dist}/object/property-paths.d.ts +2 -2
  167. package/{build → dist}/object/property-paths.d.ts.map +1 -1
  168. package/{build → dist}/object/property-paths.js +13 -9
  169. package/dist/object/security-utils.d.ts +193 -0
  170. package/dist/object/security-utils.d.ts.map +1 -0
  171. package/dist/object/security-utils.js +297 -0
  172. package/{build → dist}/object/sort-keys.d.ts +1 -1
  173. package/{build → dist}/object/sort-keys.d.ts.map +1 -1
  174. package/{build → dist}/object/sort-keys.js +18 -11
  175. package/{build → dist}/object/types.d.ts +61 -20
  176. package/dist/object/types.d.ts.map +1 -0
  177. package/dist/object/types.js +1 -0
  178. package/{build → dist}/string/assert.d.ts +5 -0
  179. package/dist/string/assert.d.ts.map +1 -0
  180. package/{build → dist}/string/assert.js +14 -10
  181. package/dist/string/case-conversion.d.ts +79 -0
  182. package/dist/string/case-conversion.d.ts.map +1 -0
  183. package/{build → dist}/string/case-conversion.js +59 -30
  184. package/dist/string/comparison.d.ts +20 -0
  185. package/dist/string/comparison.d.ts.map +1 -0
  186. package/dist/string/comparison.js +27 -0
  187. package/{build → dist}/string/formatting.d.ts +35 -22
  188. package/dist/string/formatting.d.ts.map +1 -0
  189. package/{build → dist}/string/formatting.js +40 -25
  190. package/{build → dist}/string/index.d.ts +1 -0
  191. package/{build → dist}/string/index.d.ts.map +1 -1
  192. package/{build → dist}/string/index.js +1 -1
  193. package/dist/string/transformation.d.ts +28 -0
  194. package/dist/string/transformation.d.ts.map +1 -0
  195. package/dist/string/transformation.js +42 -0
  196. package/dist/string/types.d.ts +118 -0
  197. package/dist/string/types.d.ts.map +1 -0
  198. package/dist/string/types.js +1 -0
  199. package/dist/string/validation.d.ts +30 -0
  200. package/dist/string/validation.d.ts.map +1 -0
  201. package/dist/string/validation.js +38 -0
  202. package/dist/time/elapsed-time/constants.d.ts +36 -0
  203. package/{build → dist}/time/elapsed-time/constants.d.ts.map +1 -1
  204. package/{build → dist}/time/elapsed-time/constants.js +32 -3
  205. package/{build → dist}/time/elapsed-time/elapsed-time.d.ts +67 -15
  206. package/dist/time/elapsed-time/elapsed-time.d.ts.map +1 -0
  207. package/{build → dist}/time/elapsed-time/elapsed-time.js +172 -78
  208. package/dist/time/elapsed-time/types.d.ts +336 -0
  209. package/dist/time/elapsed-time/types.d.ts.map +1 -0
  210. package/dist/time/elapsed-time/types.js +1 -0
  211. package/{build → dist}/time/elapsed-time/utils.d.ts +1 -1
  212. package/dist/time/elapsed-time/utils.d.ts.map +1 -0
  213. package/{build → dist}/time/elapsed-time/utils.js +0 -1
  214. package/{build → dist}/time/index.d.ts +0 -2
  215. package/{build → dist}/time/index.d.ts.map +1 -1
  216. package/{build → dist}/time/index.js +0 -2
  217. package/{build → dist}/time/stopwatch/entry.d.ts +1 -1
  218. package/dist/time/stopwatch/entry.d.ts.map +1 -0
  219. package/{build → dist}/time/stopwatch/entry.js +0 -1
  220. package/{build → dist}/time/stopwatch/stopwatch.d.ts +9 -3
  221. package/dist/time/stopwatch/stopwatch.d.ts.map +1 -0
  222. package/{build → dist}/time/stopwatch/stopwatch.js +9 -4
  223. package/package.json +58 -81
  224. package/LICENSE +0 -21
  225. package/build/array/array-chunk.js.map +0 -1
  226. package/build/array/array-compact.js.map +0 -1
  227. package/build/array/array-contains.js.map +0 -1
  228. package/build/array/array-count-by.d.ts.map +0 -1
  229. package/build/array/array-count-by.js.map +0 -1
  230. package/build/array/array-difference.d.ts +0 -25
  231. package/build/array/array-difference.d.ts.map +0 -1
  232. package/build/array/array-difference.js +0 -34
  233. package/build/array/array-difference.js.map +0 -1
  234. package/build/array/array-element.js +0 -2
  235. package/build/array/array-element.js.map +0 -1
  236. package/build/array/array-filter.js.map +0 -1
  237. package/build/array/array-flatten.js.map +0 -1
  238. package/build/array/array-group-by.d.ts.map +0 -1
  239. package/build/array/array-group-by.js.map +0 -1
  240. package/build/array/array-intersection.d.ts +0 -25
  241. package/build/array/array-intersection.d.ts.map +0 -1
  242. package/build/array/array-intersection.js +0 -39
  243. package/build/array/array-intersection.js.map +0 -1
  244. package/build/array/array-partition.js.map +0 -1
  245. package/build/array/array-range.js.map +0 -1
  246. package/build/array/array-sample.d.ts.map +0 -1
  247. package/build/array/array-sample.js.map +0 -1
  248. package/build/array/array-shuffle.js.map +0 -1
  249. package/build/array/array-sort-by.js.map +0 -1
  250. package/build/array/array-zip.js.map +0 -1
  251. package/build/array/assert.d.ts.map +0 -1
  252. package/build/array/assert.js.map +0 -1
  253. package/build/array/index.js.map +0 -1
  254. package/build/array/types.d.ts.map +0 -1
  255. package/build/array/types.js +0 -2
  256. package/build/array/types.js.map +0 -1
  257. package/build/array/unique.js.map +0 -1
  258. package/build/asserts/errors.d.ts.map +0 -1
  259. package/build/asserts/errors.js.map +0 -1
  260. package/build/asserts/generic.d.ts.map +0 -1
  261. package/build/asserts/generic.js.map +0 -1
  262. package/build/asserts/index.d.ts +0 -41
  263. package/build/asserts/index.d.ts.map +0 -1
  264. package/build/asserts/index.js +0 -41
  265. package/build/asserts/index.js.map +0 -1
  266. package/build/asserts/internal-utils.js.map +0 -1
  267. package/build/asserts/types.d.ts.map +0 -1
  268. package/build/asserts/types.js +0 -2
  269. package/build/asserts/types.js.map +0 -1
  270. package/build/asserts/utils.d.ts.map +0 -1
  271. package/build/asserts/utils.js.map +0 -1
  272. package/build/boolean/assert.js.map +0 -1
  273. package/build/boolean/index.d.ts +0 -9
  274. package/build/boolean/index.d.ts.map +0 -1
  275. package/build/boolean/index.js +0 -9
  276. package/build/boolean/index.js.map +0 -1
  277. package/build/enum/enum-entries.d.ts.map +0 -1
  278. package/build/enum/enum-entries.js.map +0 -1
  279. package/build/enum/enum-key-by-value.d.ts.map +0 -1
  280. package/build/enum/enum-key-by-value.js.map +0 -1
  281. package/build/enum/enum-keys.js.map +0 -1
  282. package/build/enum/enum-safe-value.d.ts.map +0 -1
  283. package/build/enum/enum-safe-value.js.map +0 -1
  284. package/build/enum/enum-values.js.map +0 -1
  285. package/build/enum/index.d.ts.map +0 -1
  286. package/build/enum/index.js.map +0 -1
  287. package/build/enum/types.js +0 -2
  288. package/build/enum/types.js.map +0 -1
  289. package/build/enum/validate-enum-value.d.ts.map +0 -1
  290. package/build/enum/validate-enum-value.js.map +0 -1
  291. package/build/function/compose.d.ts.map +0 -1
  292. package/build/function/compose.js.map +0 -1
  293. package/build/function/debounce.d.ts.map +0 -1
  294. package/build/function/debounce.js.map +0 -1
  295. package/build/function/index.js.map +0 -1
  296. package/build/function/memoize.d.ts +0 -30
  297. package/build/function/memoize.d.ts.map +0 -1
  298. package/build/function/memoize.js +0 -44
  299. package/build/function/memoize.js.map +0 -1
  300. package/build/function/once.js.map +0 -1
  301. package/build/function/sleep.js.map +0 -1
  302. package/build/function/throttle.d.ts +0 -17
  303. package/build/function/throttle.d.ts.map +0 -1
  304. package/build/function/throttle.js.map +0 -1
  305. package/build/function/types.d.ts +0 -5
  306. package/build/function/types.d.ts.map +0 -1
  307. package/build/function/types.js +0 -2
  308. package/build/function/types.js.map +0 -1
  309. package/build/index.d.ts +0 -38
  310. package/build/index.d.ts.map +0 -1
  311. package/build/index.js +0 -64
  312. package/build/index.js.map +0 -1
  313. package/build/lru-cache.d.ts.map +0 -1
  314. package/build/lru-cache.js.map +0 -1
  315. package/build/number/assert.js.map +0 -1
  316. package/build/number/index.d.ts +0 -9
  317. package/build/number/index.d.ts.map +0 -1
  318. package/build/number/index.js +0 -9
  319. package/build/number/index.js.map +0 -1
  320. package/build/object/assert-object.js.map +0 -1
  321. package/build/object/assert.d.ts.map +0 -1
  322. package/build/object/assert.js.map +0 -1
  323. package/build/object/clone.js.map +0 -1
  324. package/build/object/equals.js.map +0 -1
  325. package/build/object/filter-cached.d.ts +0 -21
  326. package/build/object/filter-cached.js.map +0 -1
  327. package/build/object/filter.js.map +0 -1
  328. package/build/object/has-circular-reference.js.map +0 -1
  329. package/build/object/hash.d.ts.map +0 -1
  330. package/build/object/hash.js.map +0 -1
  331. package/build/object/index.js.map +0 -1
  332. package/build/object/json-circular-replacer.js.map +0 -1
  333. package/build/object/key-value-pairs.js.map +0 -1
  334. package/build/object/map-cached.d.ts +0 -20
  335. package/build/object/map-cached.d.ts.map +0 -1
  336. package/build/object/map-cached.js.map +0 -1
  337. package/build/object/map.js.map +0 -1
  338. package/build/object/merge.js.map +0 -1
  339. package/build/object/object-diff.js.map +0 -1
  340. package/build/object/object-flatten.js.map +0 -1
  341. package/build/object/object-invert.js.map +0 -1
  342. package/build/object/omit.js.map +0 -1
  343. package/build/object/pick.js.map +0 -1
  344. package/build/object/property-paths.js.map +0 -1
  345. package/build/object/security-utils.d.ts +0 -59
  346. package/build/object/security-utils.d.ts.map +0 -1
  347. package/build/object/security-utils.js +0 -161
  348. package/build/object/security-utils.js.map +0 -1
  349. package/build/object/sort-keys.js.map +0 -1
  350. package/build/object/types.d.ts.map +0 -1
  351. package/build/object/types.js +0 -6
  352. package/build/object/types.js.map +0 -1
  353. package/build/string/assert.d.ts.map +0 -1
  354. package/build/string/assert.js.map +0 -1
  355. package/build/string/case-conversion.d.ts +0 -50
  356. package/build/string/case-conversion.d.ts.map +0 -1
  357. package/build/string/case-conversion.js.map +0 -1
  358. package/build/string/formatting.d.ts.map +0 -1
  359. package/build/string/formatting.js.map +0 -1
  360. package/build/string/index.js.map +0 -1
  361. package/build/string/transformation.d.ts +0 -18
  362. package/build/string/transformation.d.ts.map +0 -1
  363. package/build/string/transformation.js +0 -32
  364. package/build/string/transformation.js.map +0 -1
  365. package/build/string/types.d.ts +0 -44
  366. package/build/string/types.d.ts.map +0 -1
  367. package/build/string/types.js +0 -2
  368. package/build/string/types.js.map +0 -1
  369. package/build/string/validation.d.ts +0 -18
  370. package/build/string/validation.d.ts.map +0 -1
  371. package/build/string/validation.js +0 -26
  372. package/build/string/validation.js.map +0 -1
  373. package/build/time/elapsed-time/constants.d.ts +0 -10
  374. package/build/time/elapsed-time/constants.js.map +0 -1
  375. package/build/time/elapsed-time/elapsed-time.d.ts.map +0 -1
  376. package/build/time/elapsed-time/elapsed-time.js.map +0 -1
  377. package/build/time/elapsed-time/types.d.ts +0 -150
  378. package/build/time/elapsed-time/types.d.ts.map +0 -1
  379. package/build/time/elapsed-time/types.js +0 -2
  380. package/build/time/elapsed-time/types.js.map +0 -1
  381. package/build/time/elapsed-time/utils.d.ts.map +0 -1
  382. package/build/time/elapsed-time/utils.js.map +0 -1
  383. package/build/time/index.js.map +0 -1
  384. package/build/time/stopwatch/entry-types.d.ts +0 -13
  385. package/build/time/stopwatch/entry-types.d.ts.map +0 -1
  386. package/build/time/stopwatch/entry-types.js +0 -2
  387. package/build/time/stopwatch/entry-types.js.map +0 -1
  388. package/build/time/stopwatch/entry.d.ts.map +0 -1
  389. package/build/time/stopwatch/entry.js.map +0 -1
  390. package/build/time/stopwatch/stopwatch.d.ts.map +0 -1
  391. package/build/time/stopwatch/stopwatch.js.map +0 -1
  392. /package/{build → dist}/array/array-chunk.d.ts.map +0 -0
  393. /package/{build → dist}/array/array-compact.d.ts.map +0 -0
  394. /package/{build → dist}/array/array-element.d.ts +0 -0
  395. /package/{build → dist}/array/array-element.d.ts.map +0 -0
  396. /package/{build → dist}/array/array-range.d.ts.map +0 -0
  397. /package/{build → dist}/array/array-shuffle.d.ts.map +0 -0
  398. /package/{build → dist}/array/array-sort-by.d.ts.map +0 -0
  399. /package/{build → dist}/array/array-zip.d.ts.map +0 -0
  400. /package/{build → dist}/array/index.d.ts +0 -0
  401. /package/{build → dist}/array/index.d.ts.map +0 -0
  402. /package/{build → dist}/asserts/errors.d.ts +0 -0
  403. /package/{build → dist}/asserts/internal-utils.d.ts +0 -0
  404. /package/{build → dist}/enum/enum-keys.d.ts +0 -0
  405. /package/{build → dist}/enum/enum-keys.d.ts.map +0 -0
  406. /package/{build → dist}/enum/enum-values.d.ts +0 -0
  407. /package/{build → dist}/enum/enum-values.d.ts.map +0 -0
  408. /package/{build → dist}/enum/types.d.ts +0 -0
  409. /package/{build → dist}/enum/types.d.ts.map +0 -0
  410. /package/{build → dist}/function/index.d.ts +0 -0
  411. /package/{build → dist}/function/index.d.ts.map +0 -0
  412. /package/{build → dist}/function/sleep.d.ts +0 -0
  413. /package/{build → dist}/function/sleep.d.ts.map +0 -0
  414. /package/{build → dist}/number/assert.d.ts +0 -0
  415. /package/{build → dist}/object/clone.d.ts +0 -0
  416. /package/{build → dist}/object/has-circular-reference.d.ts +0 -0
  417. /package/{build → dist}/object/json-circular-replacer.d.ts +0 -0
  418. /package/{build → dist}/object/key-value-pairs.d.ts +0 -0
  419. /package/{build → dist}/object/key-value-pairs.d.ts.map +0 -0
  420. /package/{build → dist}/object/map.d.ts +0 -0
  421. /package/{build → dist}/object/map.d.ts.map +0 -0
  422. /package/{build → dist}/object/merge.d.ts +0 -0
  423. /package/{build → dist}/object/object-invert.d.ts +0 -0
  424. /package/{build → dist}/object/object-invert.d.ts.map +0 -0
  425. /package/{build → dist}/object/omit.d.ts +0 -0
  426. /package/{build → dist}/object/omit.d.ts.map +0 -0
  427. /package/{build → dist}/object/pick.d.ts +0 -0
  428. /package/{build → dist}/object/pick.d.ts.map +0 -0
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Security utilities for object manipulation functions
3
+ * Provides protection against prototype pollution, path traversal, and other security vulnerabilities
4
+ *
5
+ * Sensitive data patterns considered by these utilities include:
6
+ * - Prototype pollution vectors: `__proto__`, `constructor`, `prototype`
7
+ * - Path traversal sequences: `..`, encoded dots (`%2e%2e`, `%252e%252e`)
8
+ * - Null byte injections: `\0`, `%00`
9
+ * - Unicode attacks: BOM characters, reversed BOM, invalid unicode sequences
10
+ * - Malformed input: consecutive dots, leading/trailing dots, empty segments
11
+ *
12
+ * @author Security Auditor Agent
13
+ * @version 1.0.0
14
+ */
15
+ /**
16
+ * Validates if a property key is safe to use (not dangerous for prototype pollution)
17
+ *
18
+ * Blocks dangerous property names and path traversal patterns:
19
+ * - Prototype pollution vectors: `__proto__`, `constructor`, `prototype`
20
+ * - Path traversal: `..`, URL-encoded variants (`%2e%2e`, `%252e%252e`)
21
+ * - Null bytes: `\0` (literal), `%00` (URL-encoded)
22
+ * - Unicode attacks: BOM characters and invalid sequences
23
+ *
24
+ * @param key - The property key to validate
25
+ * @returns True if the key is safe to use as an object property, false if it's a known attack vector
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * IsPropertyKeySafe('name'); // true
30
+ * IsPropertyKeySafe('user_id'); // true
31
+ * IsPropertyKeySafe('__proto__'); // false (prototype pollution)
32
+ * IsPropertyKeySafe('constructor'); // false (prototype pollution)
33
+ * IsPropertyKeySafe('..'); // false (path traversal)
34
+ * IsPropertyKeySafe('%2e%2e'); // false (encoded path traversal)
35
+ * ```
36
+ */
37
+ export declare function IsPropertyKeySafe(key: string): boolean;
38
+ /**
39
+ * Validates a property path for security issues
40
+ *
41
+ * Detects and blocks malformed or dangerous paths:
42
+ * - Leading or trailing dots: `.name`, `path.`
43
+ * - Consecutive dots: `user..name` (double dot traversal)
44
+ * - Each path segment is validated via `IsPropertyKeySafe`
45
+ *
46
+ * Used by `ObjectGetPropertyByPath` and `ObjectSetPropertyByPath` to prevent
47
+ * prototype pollution and path traversal attacks. Safe for untrusted input
48
+ * when `validatePaths: true` is passed to ObjectFilter.
49
+ *
50
+ * @param path - The property path to validate using dot notation (e.g., `user.profile.name`)
51
+ * @returns True if the path is safe, false if it contains security risks
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * IsPropertyPathSafe('user.profile.name'); // true
56
+ * IsPropertyPathSafe('user..name'); // false (double dot)
57
+ * IsPropertyPathSafe('.user.name'); // false (leading dot)
58
+ * IsPropertyPathSafe('user.name.'); // false (trailing dot)
59
+ * IsPropertyPathSafe('user.__proto__.name'); // false (dangerous segment)
60
+ * ```
61
+ */
62
+ export declare function IsPropertyPathSafe(path: string): boolean;
63
+ /**
64
+ * Sanitizes a property key by removing or replacing dangerous characters
65
+ *
66
+ * Returns `null` if the key contains dangerous patterns (prototype pollution vectors,
67
+ * path traversal sequences) that cannot be safely sanitized. Otherwise returns the
68
+ * key with leading/trailing whitespace trimmed.
69
+ *
70
+ * @param key - The property key to sanitize
71
+ * @returns The sanitized key (with whitespace trimmed), or `null` if the key is dangerous
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * SanitizePropertyKey(' user.name '); // 'user.name'
76
+ * SanitizePropertyKey('__proto__'); // null (dangerous)
77
+ * SanitizePropertyKey('valid-key'); // 'valid-key'
78
+ * ```
79
+ */
80
+ export declare function SanitizePropertyKey(key: string): string | null;
81
+ /**
82
+ * Filters out dangerous keys from an object
83
+ *
84
+ * Creates a new object containing only properties whose keys pass the `IsPropertyKeySafe` check.
85
+ * Blocks prototype pollution vectors: `__proto__`, `constructor`, `prototype`.
86
+ * Safe for untrusted input. Used internally by ObjectClone and ObjectMerge.
87
+ *
88
+ * @template T - The type of the object
89
+ * @param obj - The object to filter
90
+ * @returns New object with only safe keys (subset of input properties)
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * FilterDangerousKeys({ name: 'John', __proto__: {}, valid: true });
95
+ * // { name: 'John', valid: true }
96
+ *
97
+ * FilterDangerousKeys({ a: 1, constructor: 'bad', b: 2 });
98
+ * // { a: 1, b: 2 }
99
+ * ```
100
+ */
101
+ export declare function FilterDangerousKeys<T extends Record<string, unknown>>(obj: T): Partial<T>;
102
+ /**
103
+ * Interface for circular reference detection utility
104
+ *
105
+ * Provides methods to track visited objects during recursive traversal,
106
+ * enabling detection and handling of circular references in object graphs.
107
+ *
108
+ * @remarks
109
+ * Uses a WeakSet internally for memory-efficient object tracking. Suitable for
110
+ * single-threaded traversal; not thread-safe for concurrent use.
111
+ */
112
+ export interface ICircularReferenceDetector {
113
+ /**
114
+ * Marks an object as visited
115
+ * @param obj - Object to mark as visited
116
+ */
117
+ markVisited(obj: object): void;
118
+ /**
119
+ * Checks if an object has been visited (circular reference indicator)
120
+ * @param obj - Object to check
121
+ * @returns True if object was already marked as visited
122
+ */
123
+ isVisited(obj: object): boolean;
124
+ /**
125
+ * Clears all visited object entries, resetting the detector
126
+ */
127
+ clear(): void;
128
+ }
129
+ /**
130
+ * Creates a circular reference detection utility using WeakSet
131
+ *
132
+ * Provides an efficient way to track visited objects during recursive traversal
133
+ * of object graphs, enabling detection and handling of circular references.
134
+ * The internal WeakSet allows garbage collection of visited objects when they
135
+ * are no longer referenced elsewhere.
136
+ *
137
+ * @returns An {@link ICircularReferenceDetector} instance with methods to track visited objects
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * // Create detector once and reuse across multiple calls:
142
+ * const detector = CreateCircularReferenceDetector();
143
+ *
144
+ * function traverse(obj: unknown): void {
145
+ * if (typeof obj !== 'object' || obj === null) return;
146
+ *
147
+ * if (detector.isVisited(obj)) {
148
+ * console.log('Circular reference detected!');
149
+ * return;
150
+ * }
151
+ *
152
+ * detector.markVisited(obj);
153
+ * // Process obj...
154
+ * }
155
+ *
156
+ * for (const obj of objects) {
157
+ * detector.clear(); // Reset between unrelated traversals
158
+ * traverse(obj);
159
+ * }
160
+ * ```
161
+ *
162
+ * @remarks
163
+ * Do NOT create a new detector inside a loop for each object. Create once and reuse,
164
+ * calling `clear()` between unrelated traversals. Each call to this function creates
165
+ * a new WeakSet instance, so reusing is more efficient.
166
+ */
167
+ export declare function CreateCircularReferenceDetector(): ICircularReferenceDetector;
168
+ /**
169
+ * Validates input for common security issues
170
+ *
171
+ * Checks for:
172
+ * - String length exceeding `maxLength` (default: 10,000 chars) to prevent DoS
173
+ * - Path traversal patterns: `..`, encoded variants, null bytes, unicode attacks
174
+ * - Null/undefined are considered safe (falsy validation only)
175
+ *
176
+ * Designed primarily for property path validation in `ObjectSetPropertyByPath` and
177
+ * related functions. Not a general-purpose string validator.
178
+ *
179
+ * @param input - Input to validate (typically a property path or key string)
180
+ * @param maxLength - Maximum allowed string length in characters (default: 10,000)
181
+ * @returns True if input is safe, false if it exceeds length or contains attack patterns
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * IsInputSafe('user.profile.name'); // true
186
+ * IsInputSafe('user..name'); // false (path traversal)
187
+ * IsInputSafe('a'.repeat(20000)); // false (exceeds default length)
188
+ * IsInputSafe(null); // true (null is safe)
189
+ * IsInputSafe('%2e%2e'); // false (encoded traversal)
190
+ * ```
191
+ */
192
+ export declare function IsInputSafe(input: unknown, maxLength?: number): boolean;
193
+ //# sourceMappingURL=security-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-utils.d.ts","sourceRoot":"","sources":["../../src/object/security-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA+CH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAkBtD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAkBxD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO9D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAUzF;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;OAGG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;;;OAIG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAEhC;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,+BAA+B,IAAI,0BAA0B,CA6B5E;AAKD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,GAAE,MAAiC,GAAG,OAAO,CAqBjG"}
@@ -0,0 +1,297 @@
1
+ /**
2
+ * Security utilities for object manipulation functions
3
+ * Provides protection against prototype pollution, path traversal, and other security vulnerabilities
4
+ *
5
+ * Sensitive data patterns considered by these utilities include:
6
+ * - Prototype pollution vectors: `__proto__`, `constructor`, `prototype`
7
+ * - Path traversal sequences: `..`, encoded dots (`%2e%2e`, `%252e%252e`)
8
+ * - Null byte injections: `\0`, `%00`
9
+ * - Unicode attacks: BOM characters, reversed BOM, invalid unicode sequences
10
+ * - Malformed input: consecutive dots, leading/trailing dots, empty segments
11
+ *
12
+ * @author Security Auditor Agent
13
+ * @version 1.0.0
14
+ */
15
+ /**
16
+ * List of dangerous property names that should be blocked to prevent prototype pollution.
17
+ * Only the three canonical prototype-pollution vectors are blocked; other Object.prototype
18
+ * methods (toString, valueOf, hasOwnProperty, etc.) are legitimate property names.
19
+ */
20
+ const /**
21
+ * Property names that are commonly used in prototype pollution attacks.
22
+ *
23
+ * This list blocks direct assignment to the most common attack vectors
24
+ * (__proto__, constructor, prototype) but is not a complete sandbox.
25
+ * It prevents the most obvious exploitation paths and should be combined
26
+ * with other security measures such as object freezing and deep cloning
27
+ * for sensitive data structures.
28
+ */ DANGEROUS_PROPERTY_NAMES = new Set([
29
+ '__proto__',
30
+ 'constructor',
31
+ 'prototype',
32
+ ]);
33
+ /**
34
+ * Regular expression patterns for detecting path traversal attempts.
35
+ *
36
+ * Includes:
37
+ * - URL-encoded dots (both single and double encoding)
38
+ * - Null byte injection (both as \0 literal and %00 URL-encoded)
39
+ * - Unicode BOM and invalid character sequences
40
+ *
41
+ * NOTE: Null byte detection is informational and defensive-in-depth.
42
+ * JavaScript strings handle null bytes safely by design — they do not
43
+ * truncate at null bytes like C strings do. This pattern is included
44
+ * to flag suspicious input that may have been crafted for other contexts.
45
+ *
46
+ * PERFORMANCE NOTE: All patterns avoid nested quantifiers that could cause
47
+ * ReDoS (Regular Expression Denial of Service). Each pattern is simple and
48
+ * anchored to prevent catastrophic backtracking.
49
+ */
50
+ const PATH_TRAVERSAL_PATTERNS = [
51
+ /%2e%2e/i, // URL encoded ..
52
+ /%252e%252e/i, // Double URL encoded ..
53
+ new RegExp(String.fromCharCode(0)), // Null byte injection
54
+ /%00/i, // URL encoded null byte
55
+ new RegExp('[\\u200b\\ufeff\\ufffe\\uffff]'), // Unicode BOM, reversed BOM, and invalid characters
56
+ ];
57
+ /**
58
+ * Validates if a property key is safe to use (not dangerous for prototype pollution)
59
+ *
60
+ * Blocks dangerous property names and path traversal patterns:
61
+ * - Prototype pollution vectors: `__proto__`, `constructor`, `prototype`
62
+ * - Path traversal: `..`, URL-encoded variants (`%2e%2e`, `%252e%252e`)
63
+ * - Null bytes: `\0` (literal), `%00` (URL-encoded)
64
+ * - Unicode attacks: BOM characters and invalid sequences
65
+ *
66
+ * @param key - The property key to validate
67
+ * @returns True if the key is safe to use as an object property, false if it's a known attack vector
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * IsPropertyKeySafe('name'); // true
72
+ * IsPropertyKeySafe('user_id'); // true
73
+ * IsPropertyKeySafe('__proto__'); // false (prototype pollution)
74
+ * IsPropertyKeySafe('constructor'); // false (prototype pollution)
75
+ * IsPropertyKeySafe('..'); // false (path traversal)
76
+ * IsPropertyKeySafe('%2e%2e'); // false (encoded path traversal)
77
+ * ```
78
+ */
79
+ export function IsPropertyKeySafe(key) {
80
+ if (typeof key !== 'string') {
81
+ return false;
82
+ }
83
+ // Check against dangerous property names
84
+ if (DANGEROUS_PROPERTY_NAMES.has(key)) {
85
+ return false;
86
+ }
87
+ // Check for path traversal patterns
88
+ for (const pattern of PATH_TRAVERSAL_PATTERNS) {
89
+ if (pattern.test(key)) {
90
+ return false;
91
+ }
92
+ }
93
+ return true;
94
+ }
95
+ /**
96
+ * Validates a property path for security issues
97
+ *
98
+ * Detects and blocks malformed or dangerous paths:
99
+ * - Leading or trailing dots: `.name`, `path.`
100
+ * - Consecutive dots: `user..name` (double dot traversal)
101
+ * - Each path segment is validated via `IsPropertyKeySafe`
102
+ *
103
+ * Used by `ObjectGetPropertyByPath` and `ObjectSetPropertyByPath` to prevent
104
+ * prototype pollution and path traversal attacks. Safe for untrusted input
105
+ * when `validatePaths: true` is passed to ObjectFilter.
106
+ *
107
+ * @param path - The property path to validate using dot notation (e.g., `user.profile.name`)
108
+ * @returns True if the path is safe, false if it contains security risks
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * IsPropertyPathSafe('user.profile.name'); // true
113
+ * IsPropertyPathSafe('user..name'); // false (double dot)
114
+ * IsPropertyPathSafe('.user.name'); // false (leading dot)
115
+ * IsPropertyPathSafe('user.name.'); // false (trailing dot)
116
+ * IsPropertyPathSafe('user.__proto__.name'); // false (dangerous segment)
117
+ * ```
118
+ */
119
+ export function IsPropertyPathSafe(path) {
120
+ if (!path || typeof path !== 'string') {
121
+ return false;
122
+ }
123
+ // Check if path starts or ends with a dot
124
+ if (path.startsWith('.') || path.endsWith('.')) {
125
+ return false;
126
+ }
127
+ // Check for consecutive dots (potential traversal)
128
+ if (path.includes('..')) {
129
+ return false;
130
+ }
131
+ // Validate each segment of the path
132
+ const segments = path.split('.');
133
+ return segments.every((segment) => IsPropertyKeySafe(segment));
134
+ }
135
+ /**
136
+ * Sanitizes a property key by removing or replacing dangerous characters
137
+ *
138
+ * Returns `null` if the key contains dangerous patterns (prototype pollution vectors,
139
+ * path traversal sequences) that cannot be safely sanitized. Otherwise returns the
140
+ * key with leading/trailing whitespace trimmed.
141
+ *
142
+ * @param key - The property key to sanitize
143
+ * @returns The sanitized key (with whitespace trimmed), or `null` if the key is dangerous
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * SanitizePropertyKey(' user.name '); // 'user.name'
148
+ * SanitizePropertyKey('__proto__'); // null (dangerous)
149
+ * SanitizePropertyKey('valid-key'); // 'valid-key'
150
+ * ```
151
+ */
152
+ export function SanitizePropertyKey(key) {
153
+ if (!IsPropertyKeySafe(key)) {
154
+ return null;
155
+ }
156
+ // Additional sanitization for edge cases
157
+ return key.trim();
158
+ }
159
+ /**
160
+ * Filters out dangerous keys from an object
161
+ *
162
+ * Creates a new object containing only properties whose keys pass the `IsPropertyKeySafe` check.
163
+ * Blocks prototype pollution vectors: `__proto__`, `constructor`, `prototype`.
164
+ * Safe for untrusted input. Used internally by ObjectClone and ObjectMerge.
165
+ *
166
+ * @template T - The type of the object
167
+ * @param obj - The object to filter
168
+ * @returns New object with only safe keys (subset of input properties)
169
+ *
170
+ * @example
171
+ * ```typescript
172
+ * FilterDangerousKeys({ name: 'John', __proto__: {}, valid: true });
173
+ * // { name: 'John', valid: true }
174
+ *
175
+ * FilterDangerousKeys({ a: 1, constructor: 'bad', b: 2 });
176
+ * // { a: 1, b: 2 }
177
+ * ```
178
+ */
179
+ export function FilterDangerousKeys(obj) {
180
+ const filtered = {};
181
+ for (const key in obj) {
182
+ if (Object.hasOwn(obj, key) && IsPropertyKeySafe(key)) {
183
+ filtered[key] = obj[key];
184
+ }
185
+ }
186
+ return filtered;
187
+ }
188
+ /**
189
+ * Creates a circular reference detection utility using WeakSet
190
+ *
191
+ * Provides an efficient way to track visited objects during recursive traversal
192
+ * of object graphs, enabling detection and handling of circular references.
193
+ * The internal WeakSet allows garbage collection of visited objects when they
194
+ * are no longer referenced elsewhere.
195
+ *
196
+ * @returns An {@link ICircularReferenceDetector} instance with methods to track visited objects
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * // Create detector once and reuse across multiple calls:
201
+ * const detector = CreateCircularReferenceDetector();
202
+ *
203
+ * function traverse(obj: unknown): void {
204
+ * if (typeof obj !== 'object' || obj === null) return;
205
+ *
206
+ * if (detector.isVisited(obj)) {
207
+ * console.log('Circular reference detected!');
208
+ * return;
209
+ * }
210
+ *
211
+ * detector.markVisited(obj);
212
+ * // Process obj...
213
+ * }
214
+ *
215
+ * for (const obj of objects) {
216
+ * detector.clear(); // Reset between unrelated traversals
217
+ * traverse(obj);
218
+ * }
219
+ * ```
220
+ *
221
+ * @remarks
222
+ * Do NOT create a new detector inside a loop for each object. Create once and reuse,
223
+ * calling `clear()` between unrelated traversals. Each call to this function creates
224
+ * a new WeakSet instance, so reusing is more efficient.
225
+ */
226
+ export function CreateCircularReferenceDetector() {
227
+ let visited = new WeakSet();
228
+ return {
229
+ /**
230
+ * Marks an object as visited
231
+ * @param obj - Object to mark as visited
232
+ */
233
+ markVisited(obj) {
234
+ visited.add(obj);
235
+ },
236
+ /**
237
+ * Checks if an object has been visited (circular reference)
238
+ * @param obj - Object to check
239
+ * @returns True if object was already visited
240
+ */
241
+ isVisited(obj) {
242
+ return visited.has(obj);
243
+ },
244
+ /**
245
+ * Clears the visited objects set
246
+ */
247
+ clear() {
248
+ // WeakSet doesn't have a clear method, so we create a new one
249
+ visited = new WeakSet();
250
+ },
251
+ };
252
+ }
253
+ /** Default maximum input length for security validation */
254
+ const DEFAULT_MAX_INPUT_LENGTH = 10000;
255
+ /**
256
+ * Validates input for common security issues
257
+ *
258
+ * Checks for:
259
+ * - String length exceeding `maxLength` (default: 10,000 chars) to prevent DoS
260
+ * - Path traversal patterns: `..`, encoded variants, null bytes, unicode attacks
261
+ * - Null/undefined are considered safe (falsy validation only)
262
+ *
263
+ * Designed primarily for property path validation in `ObjectSetPropertyByPath` and
264
+ * related functions. Not a general-purpose string validator.
265
+ *
266
+ * @param input - Input to validate (typically a property path or key string)
267
+ * @param maxLength - Maximum allowed string length in characters (default: 10,000)
268
+ * @returns True if input is safe, false if it exceeds length or contains attack patterns
269
+ *
270
+ * @example
271
+ * ```typescript
272
+ * IsInputSafe('user.profile.name'); // true
273
+ * IsInputSafe('user..name'); // false (path traversal)
274
+ * IsInputSafe('a'.repeat(20000)); // false (exceeds default length)
275
+ * IsInputSafe(null); // true (null is safe)
276
+ * IsInputSafe('%2e%2e'); // false (encoded traversal)
277
+ * ```
278
+ */
279
+ export function IsInputSafe(input, maxLength = DEFAULT_MAX_INPUT_LENGTH) {
280
+ // Check for null/undefined
281
+ if (input === null || input === undefined) {
282
+ return true;
283
+ }
284
+ // Check string length to prevent DoS
285
+ if (typeof input === 'string' && input.length > maxLength) {
286
+ return false;
287
+ }
288
+ // Check for dangerous string patterns
289
+ if (typeof input === 'string') {
290
+ for (const pattern of PATH_TRAVERSAL_PATTERNS) {
291
+ if (pattern.test(input)) {
292
+ return false;
293
+ }
294
+ }
295
+ }
296
+ return true;
297
+ }
@@ -22,5 +22,5 @@
22
22
  * // Result: { active: true, age: 30, email: 'john@example.com', name: 'John' }
23
23
  * ```
24
24
  */
25
- export declare function ObjectSortKeys<T extends Record<string, any>>(object: T): T;
25
+ export declare function ObjectSortKeys<T extends Record<string, unknown>>(object: T): T;
26
26
  //# sourceMappingURL=sort-keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sort-keys.d.ts","sourceRoot":"","sources":["../../src/object/sort-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CA+B1E"}
1
+ {"version":3,"file":"sort-keys.d.ts","sourceRoot":"","sources":["../../src/object/sort-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAuC9E"}
@@ -26,7 +26,21 @@ export function ObjectSortKeys(object) {
26
26
  if (!object || typeof object !== 'object' || Array.isArray(object)) {
27
27
  return object;
28
28
  }
29
- const sorted = Object.keys(object).sort((a, b) => {
29
+ // Single-pass collection: get all property names and classify them by enumerability
30
+ const allKeys = Object.getOwnPropertyNames(object);
31
+ const enumerableKeys = [];
32
+ const nonEnumerableDescriptors = [];
33
+ for (const key of allKeys) {
34
+ const descriptor = Object.getOwnPropertyDescriptor(object, key);
35
+ if (descriptor?.enumerable) {
36
+ enumerableKeys.push(key);
37
+ }
38
+ else if (descriptor) {
39
+ nonEnumerableDescriptors.push([key, descriptor]);
40
+ }
41
+ }
42
+ // Sort enumerable keys and build result with them
43
+ const sorted = enumerableKeys.sort((a, b) => {
30
44
  if (a < b)
31
45
  return -1;
32
46
  if (a > b)
@@ -37,16 +51,9 @@ export function ObjectSortKeys(object) {
37
51
  entry[key] = object[key];
38
52
  return entry;
39
53
  }, {});
40
- // Preserve non-enumerable properties
41
- const allKeys = Object.getOwnPropertyNames(object);
42
- for (const key of allKeys) {
43
- if (!Object.hasOwn(sorted, key)) {
44
- const descriptor = Object.getOwnPropertyDescriptor(object, key);
45
- if (descriptor) {
46
- Object.defineProperty(sorted, key, descriptor);
47
- }
48
- }
54
+ // Restore non-enumerable properties with their original descriptors
55
+ for (const [key, descriptor] of nonEnumerableDescriptors) {
56
+ Object.defineProperty(sorted, key, descriptor);
49
57
  }
50
58
  return sorted;
51
59
  }
52
- //# sourceMappingURL=sort-keys.js.map
@@ -1,60 +1,101 @@
1
- /**
2
- * A constructor function type for creating objects of type O.
3
- * @template O The object type to construct.
4
- */
5
- export type TConstructableObject<O extends object = object> = new (...args: any[]) => O;
6
1
  /**
7
2
  * Omits properties from B that are not in A.
8
- * @template A Base type.
9
- * @template B Type to filter.
3
+ *
4
+ * @template A - Base type.
5
+ * @template B - Type to filter.
6
+ *
7
+ * @remarks
8
+ * Currently exported but not used by public API functions. Reserved for future use
9
+ * as an extension point for constrained object transformations or validation scenarios.
10
10
  */
11
11
  export type TObjectOmitExtraProperties<A, B> = {
12
12
  [K in keyof B]: K extends A ? B[K] : never;
13
13
  };
14
14
  /**
15
15
  * Extracts the property keys of an object type.
16
- * @template O The object type.
16
+ *
17
+ * @template O - The object type.
18
+ *
19
+ * @remarks
20
+ * Currently exported but not used by public API functions. Reserved for future use
21
+ * as a generic property introspection utility or type constraint.
17
22
  */
18
23
  export type TObjectProperties<O extends object> = keyof O;
19
24
  /**
20
25
  * Extracts property keys of a specific type from an object.
21
- * @template O Object type.
22
- * @template PropertyType The type to match.
26
+ *
27
+ * @template O - Object type.
28
+ * @template PropertyType - The type to match.
29
+ *
30
+ * @remarks
31
+ * Currently exported but not used by public API functions. Reserved for future use
32
+ * in type-filtered property transformations or validations (e.g., filtering all
33
+ * string properties, all optional properties, or all array properties).
23
34
  */
24
35
  export type TObjectPropertiesOfType<O extends object, PropertyType> = keyof {
25
- [K in keyof O as O[K] extends PropertyType ? K : never]: any;
36
+ [K in keyof O as O[K] extends PropertyType ? K : never]: unknown;
26
37
  };
27
38
  /**
28
39
  * Omits properties of a specific type from an object.
29
- * @template O Object type.
30
- * @template PropertyType The type to omit.
40
+ *
41
+ * @template O - Object type.
42
+ * @template PropertyType - The type to omit.
43
+ *
44
+ * @remarks
45
+ * Currently exported but not used by public API functions. Reserved for future use
46
+ * in scenarios requiring conditional property exclusion based on value type
47
+ * (e.g., extracting only non-array properties, or excluding optional properties).
31
48
  */
32
49
  export type TObjectOmitPropertiesOfType<O extends object, PropertyType> = {
33
50
  [K in keyof O as O[K] extends PropertyType ? never : K]: O[K];
34
51
  };
35
52
  /**
36
53
  * Represents the union of all property values in an object.
37
- * @template T Object type.
54
+ *
55
+ * @template T - Object type.
56
+ *
57
+ * @remarks
58
+ * Currently exported but not used by public API functions. Reserved for future use
59
+ * in generic object value introspection or validation scenarios.
38
60
  */
39
61
  export type TObjectPropertyType<T extends object> = T[keyof T];
40
62
  /**
41
63
  * Extracts properties shared between two object types.
42
- * @template A First object type.
43
- * @template B Second object type.
64
+ *
65
+ * @template A - First object type.
66
+ * @template B - Second object type.
67
+ *
68
+ * @remarks
69
+ * Currently exported but not used by public API functions. Reserved for future use
70
+ * in scenarios requiring intersection of object types or common property extraction
71
+ * for schema validation or type merging operations.
44
72
  */
45
73
  export type TObjectSharedProperties<A extends object, B extends object> = {
46
74
  [K in keyof A & keyof B]: K extends keyof A ? A[K] : never;
47
75
  };
48
76
  /**
49
77
  * Extracts keys of array properties from an object type.
50
- * @template T Object type.
78
+ *
79
+ * @template T - Object type.
80
+ *
81
+ * @remarks
82
+ * Currently exported but not used by public API functions. Reserved for future use
83
+ * in scenarios requiring filtering of array-typed properties, such as validating
84
+ * array field schemas or transforming only array properties in an object.
51
85
  */
52
86
  export type TObjectArrayProperties<T extends object> = {
53
- [K in keyof T]: T[K] extends Array<any> ? K : never;
87
+ [K in keyof T]: T[K] extends Array<unknown> ? K : never;
54
88
  }[keyof T];
55
89
  /**
56
90
  * Generates nested dot-notation keys for an object type.
57
- * @template ObjectType The object type.
91
+ *
92
+ * @template ObjectType - The object type to generate keys for.
93
+ *
94
+ * @remarks
95
+ * Currently exported but not used by public API functions. Reserved for future use
96
+ * in scenarios requiring type-safe nested property access, such as advanced path
97
+ * navigation utilities or deep property validation frameworks that benefit from
98
+ * compile-time validation of dot-notation paths.
58
99
  */
59
100
  export type TObjectNestedKeyOf<ObjectType extends object> = {
60
101
  [Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object ? `${Key}` | `${Key}.${TObjectNestedKeyOf<ObjectType[Key]>}` : `${Key}`;
@@ -94,7 +135,7 @@ export interface ICachedObjectMapOptions {
94
135
  * Type for cached object filter functions.
95
136
  * @template T The object type being filtered.
96
137
  */
97
- export type TCachedObjectFilterFunction<T extends object> = (cursor: T, filter: Partial<Record<string, any>>) => Promise<boolean>;
138
+ export type TCachedObjectFilterFunction<T extends object> = (cursor: T, filter: Partial<Record<string, unknown>>) => Promise<boolean>;
98
139
  /**
99
140
  * Type for cached object map functions.
100
141
  * @template T The object type being mapped.