@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 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/object/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH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G,EAAE,CAAC,EACN,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KACP,OAAO,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -3,8 +3,13 @@ import { SimpleError } from '../asserts/errors.js';
3
3
  /**
4
4
  * Error thrown when a value is not a valid string or fails a string assertion.
5
5
  *
6
+ * @returns A StringError instance with the provided message
7
+ * @throws N/A - This is an error class constructor
8
+ *
6
9
  * @example
10
+ * ```typescript
7
11
  * throw new StringError('Value is not a valid string');
12
+ * ```
8
13
  */
9
14
  export declare class StringError extends SimpleError {
10
15
  constructor(message?: string);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/string/assert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA8CnD;;;;;;;;;;GAUG;AACH,qBAAa,WAAY,SAAQ,WAAW;gBAC/B,OAAO,CAAC,EAAE,MAAM;CAG5B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,GAAE,gBAAqB,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAGtG;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,GAAE,gBAAqB,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAY9G;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,GAAE,gBAAqB,GAAG,IAAI,CAsBxG"}
@@ -1,4 +1,4 @@
1
- import { SetExceptionClass, SetExceptionMessage, ThrowException } from '../asserts/utils.js';
1
+ import { SetExceptionClass, SetExceptionMessage, ThrowException, AssertValueType } from '../asserts/utils.js';
2
2
  import { SimpleError } from '../asserts/errors.js';
3
3
  import { LRUCache } from '../lru-cache.js';
4
4
  /**
@@ -19,6 +19,12 @@ const REGEX_PATTERN_CACHE = new LRUCache(MAX_CACHE_SIZE);
19
19
  * Gets a cached regex pattern or creates and caches a new one.
20
20
  * This optimization improves performance when the same regex patterns are used repeatedly.
21
21
  *
22
+ * The cache key format `${source}:::${flags}` is safe because:
23
+ * - The `source` parameter is validated by RegExp constructor (throws on invalid patterns)
24
+ * - The `flags` parameter is validated by RegExp constructor (throws on invalid flags)
25
+ * - No user-supplied input is included in the cache key beyond these validated components
26
+ * - The separator ':::' cannot appear in valid regex flags, preventing key collision
27
+ *
22
28
  * @param source - The regex pattern source string
23
29
  * @param flags - The regex flags string
24
30
  * @returns The compiled RegExp object
@@ -37,8 +43,13 @@ function getCachedRegex(source, flags = '') {
37
43
  /**
38
44
  * Error thrown when a value is not a valid string or fails a string assertion.
39
45
  *
46
+ * @returns A StringError instance with the provided message
47
+ * @throws N/A - This is an error class constructor
48
+ *
40
49
  * @example
50
+ * ```typescript
41
51
  * throw new StringError('Value is not a valid string');
52
+ * ```
42
53
  */
43
54
  export class StringError extends SimpleError {
44
55
  constructor(message) {
@@ -69,10 +80,7 @@ export class StringError extends SimpleError {
69
80
  */
70
81
  export function AssertString(value, exception = {}) {
71
82
  SetExceptionClass(exception, StringError);
72
- if (typeof value !== 'string') {
73
- SetExceptionMessage(exception, `Expected string but received ${typeof value}: ${String(value)}`);
74
- ThrowException(exception);
75
- }
83
+ AssertValueType(value, 'string', exception);
76
84
  }
77
85
  /**
78
86
  * Asserts that a value is a non-empty string (after trimming whitespace).
@@ -100,10 +108,7 @@ export function AssertString(value, exception = {}) {
100
108
  */
101
109
  export function AssertStringNotEmpty(value, exception = {}) {
102
110
  SetExceptionClass(exception, StringError);
103
- if (typeof value !== 'string') {
104
- SetExceptionMessage(exception, `Expected non-empty string but received ${typeof value}: ${String(value)}`);
105
- ThrowException(exception);
106
- }
111
+ AssertValueType(value, 'string', exception);
107
112
  const str = value;
108
113
  if (str === '') {
109
114
  SetExceptionMessage(exception, 'Expected non-empty string but received empty string');
@@ -175,4 +180,3 @@ export function AssertStringMatches(value, regex, exception = {}) {
175
180
  ThrowException(exception);
176
181
  }
177
182
  }
178
- //# sourceMappingURL=assert.js.map
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Converts a string to camelCase.
3
+ *
4
+ * @param value - The input string
5
+ * @returns The camelCased string
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * CamelCase('Hello-World'); // 'helloWorld'
10
+ * CamelCase('hello_world'); // 'helloWorld'
11
+ * ```
12
+ */
13
+ export declare function CamelCase(value: string): string;
14
+ /**
15
+ * Capitalizes the first letter of a string.
16
+ *
17
+ * @param value - The input string
18
+ * @returns The capitalized string
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * Capitalize('hello'); // 'Hello'
23
+ * Capitalize('hello world'); // 'Hello world'
24
+ * ```
25
+ */
26
+ export declare function Capitalize(value: string): string;
27
+ /**
28
+ * Converts a string to kebab-case.
29
+ *
30
+ * @param value - The input string
31
+ * @returns The kebab-cased string
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * KebabCase('HelloWorld'); // 'hello-world'
36
+ * KebabCase('hello_world'); // 'hello-world'
37
+ * ```
38
+ */
39
+ export declare function KebabCase(value: string): string;
40
+ /**
41
+ * Converts a string to PascalCase.
42
+ *
43
+ * @param value - The input string
44
+ * @returns The PascalCased string
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * PascalCase('hello-world'); // 'HelloWorld'
49
+ * PascalCase('hello_world'); // 'HelloWorld'
50
+ * ```
51
+ */
52
+ export declare function PascalCase(value: string): string;
53
+ /**
54
+ * Converts a string to snake_case.
55
+ *
56
+ * @param value - The input string
57
+ * @returns The snake_cased string
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * SnakeCase('HelloWorld'); // 'hello_world'
62
+ * SnakeCase('hello-world'); // 'hello_world'
63
+ * ```
64
+ */
65
+ export declare function SnakeCase(value: string): string;
66
+ /**
67
+ * Converts a string to SCREAMING_SNAKE_CASE.
68
+ *
69
+ * @param value - The input string
70
+ * @returns The SCREAMING_SNAKE_CASED string
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * ScreamingSnakeCase('HelloWorld'); // 'HELLO_WORLD'
75
+ * ScreamingSnakeCase('hello-world'); // 'HELLO_WORLD'
76
+ * ```
77
+ */
78
+ export declare function ScreamingSnakeCase(value: string): string;
79
+ //# sourceMappingURL=case-conversion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"case-conversion.d.ts","sourceRoot":"","sources":["../../src/string/case-conversion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAY/C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAS/C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYhD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAS/C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD"}
@@ -1,9 +1,14 @@
1
1
  /**
2
2
  * Converts a string to camelCase.
3
3
  *
4
- * @param value The input string.
5
- * @returns The camelCased string.
6
- * @see {@link TCaseConverter}
4
+ * @param value - The input string
5
+ * @returns The camelCased string
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * CamelCase('Hello-World'); // 'helloWorld'
10
+ * CamelCase('hello_world'); // 'helloWorld'
11
+ * ```
7
12
  */
8
13
  export function CamelCase(value) {
9
14
  if (value && typeof value === 'string') {
@@ -20,24 +25,34 @@ export function CamelCase(value) {
20
25
  /**
21
26
  * Capitalizes the first letter of a string.
22
27
  *
23
- * @param value The input string.
24
- * @returns The capitalized string.
25
- * @see {@link TCaseConverter}
28
+ * @param value - The input string
29
+ * @returns The capitalized string
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * Capitalize('hello'); // 'Hello'
34
+ * Capitalize('hello world'); // 'Hello world'
35
+ * ```
26
36
  */
27
- export const CAPITALIZE = (value) => {
37
+ export function Capitalize(value) {
28
38
  if (value && typeof value === 'string') {
29
39
  return value.charAt(0).toUpperCase() + value.slice(1);
30
40
  }
31
41
  return '';
32
- };
42
+ }
33
43
  /**
34
44
  * Converts a string to kebab-case.
35
45
  *
36
- * @param value The input string.
37
- * @returns The kebab-cased string.
38
- * @see {@link TCaseConverter}
46
+ * @param value - The input string
47
+ * @returns The kebab-cased string
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * KebabCase('HelloWorld'); // 'hello-world'
52
+ * KebabCase('hello_world'); // 'hello-world'
53
+ * ```
39
54
  */
40
- export const KEBAB_CASE = (value) => {
55
+ export function KebabCase(value) {
41
56
  if (value && typeof value === 'string') {
42
57
  return value
43
58
  .replace(/(?<lower>[a-z])(?<upper>[A-Z])/gu, '$1-$2')
@@ -45,15 +60,20 @@ export const KEBAB_CASE = (value) => {
45
60
  .toLowerCase();
46
61
  }
47
62
  return '';
48
- };
63
+ }
49
64
  /**
50
65
  * Converts a string to PascalCase.
51
66
  *
52
- * @param value The input string.
53
- * @returns The PascalCased string.
54
- * @see {@link TCaseConverter}
67
+ * @param value - The input string
68
+ * @returns The PascalCased string
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * PascalCase('hello-world'); // 'HelloWorld'
73
+ * PascalCase('hello_world'); // 'HelloWorld'
74
+ * ```
55
75
  */
56
- export const PASCAL_CASE = (value) => {
76
+ export function PascalCase(value) {
57
77
  if (value && typeof value === 'string') {
58
78
  return value
59
79
  .replace(/(?:^\w|[A-Z]|\b\w)/gu, (word) => {
@@ -64,15 +84,20 @@ export const PASCAL_CASE = (value) => {
64
84
  });
65
85
  }
66
86
  return '';
67
- };
87
+ }
68
88
  /**
69
89
  * Converts a string to snake_case.
70
90
  *
71
- * @param value The input string.
72
- * @returns The snake_cased string.
73
- * @see {@link TCaseConverter}
91
+ * @param value - The input string
92
+ * @returns The snake_cased string
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * SnakeCase('HelloWorld'); // 'hello_world'
97
+ * SnakeCase('hello-world'); // 'hello_world'
98
+ * ```
74
99
  */
75
- export const SNAKE_CASE = (value) => {
100
+ export function SnakeCase(value) {
76
101
  if (value && typeof value === 'string') {
77
102
  return value
78
103
  .replace(/(?<lower>[a-z])(?<upper>[A-Z])/gu, '$1_$2')
@@ -80,15 +105,19 @@ export const SNAKE_CASE = (value) => {
80
105
  .toLowerCase();
81
106
  }
82
107
  return '';
83
- };
108
+ }
84
109
  /**
85
110
  * Converts a string to SCREAMING_SNAKE_CASE.
86
111
  *
87
- * @param value The input string.
88
- * @returns The SCREAMING_SNAKE_CASED string.
89
- * @see {@link TCaseConverter}
112
+ * @param value - The input string
113
+ * @returns The SCREAMING_SNAKE_CASED string
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * ScreamingSnakeCase('HelloWorld'); // 'HELLO_WORLD'
118
+ * ScreamingSnakeCase('hello-world'); // 'HELLO_WORLD'
119
+ * ```
90
120
  */
91
- export const SCREAMING_SNAKE_CASE = (value) => {
92
- return SNAKE_CASE(value).toUpperCase();
93
- };
94
- //# sourceMappingURL=case-conversion.js.map
121
+ export function ScreamingSnakeCase(value) {
122
+ return SnakeCase(value).toUpperCase();
123
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Compares two strings with optional case-insensitive matching.
3
+ *
4
+ * @param a - The first string to compare
5
+ * @param b - The second string to compare
6
+ * @param caseInsensitive - Whether to perform case-insensitive comparison (default: false)
7
+ * @returns True if the strings match according to the comparison mode
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * StringEquals('Hello', 'Hello'); // true
12
+ * StringEquals('Hello', 'hello'); // false
13
+ * StringEquals('Hello', 'hello', true); // true
14
+ * ```
15
+ *
16
+ * @see {@link IsBlankString}
17
+ * @see {@link Capitalize}
18
+ */
19
+ export declare function StringEquals(a: string, b: string, caseInsensitive?: boolean): boolean;
20
+ //# sourceMappingURL=comparison.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../src/string/comparison.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,eAAe,UAAQ,GAAG,OAAO,CAQnF"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Compares two strings with optional case-insensitive matching.
3
+ *
4
+ * @param a - The first string to compare
5
+ * @param b - The second string to compare
6
+ * @param caseInsensitive - Whether to perform case-insensitive comparison (default: false)
7
+ * @returns True if the strings match according to the comparison mode
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * StringEquals('Hello', 'Hello'); // true
12
+ * StringEquals('Hello', 'hello'); // false
13
+ * StringEquals('Hello', 'hello', true); // true
14
+ * ```
15
+ *
16
+ * @see {@link IsBlankString}
17
+ * @see {@link Capitalize}
18
+ */
19
+ export function StringEquals(a, b, caseInsensitive = false) {
20
+ if (caseInsensitive) {
21
+ // Note: toLowerCase() allocates a new string per call.
22
+ // For performance-critical loops (>1000 calls/sec), consider:
23
+ // a.localeCompare(b, undefined, { sensitivity: 'accent' }) which avoids allocations.
24
+ return a.toLowerCase() === b.toLowerCase();
25
+ }
26
+ return a === b;
27
+ }
@@ -14,8 +14,8 @@ import type { TFormatParams, TFormatArgs } from './types.js';
14
14
  */
15
15
  export declare function EscapeHTML(str: string): string;
16
16
  /**
17
- * Formats a string by replacing placeholders with values
18
- * Supports both named placeholders {name} and positional {0}, {1}
17
+ * Formats a string by replacing placeholders with values.
18
+ * Supports both named placeholders {name} and positional {0}, {1}.
19
19
  *
20
20
  * @param template - The template string with placeholders
21
21
  * @param params - Either an object with named parameters or array of positional parameters
@@ -40,27 +40,40 @@ export declare function FormatString(template: string, params: TFormatParams | T
40
40
  /**
41
41
  * Truncates a string to a specified length, appending an ellipsis if truncated.
42
42
  *
43
- * @param str The string to truncate.
44
- * @param maxLength The maximum length before truncation.
45
- * @param ellipsis The string to append when truncated (default: '...').
46
- * @returns The truncated string.
43
+ * @param str - The string to truncate
44
+ * @param maxLength - The maximum length before truncation
45
+ * @param ellipsis - The string to append when truncated (default: '...')
46
+ * @returns The truncated string
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * TruncateString('Hello World', 5); // 'Hello...'
51
+ * TruncateString('Hello World', 5, '!'); // 'Hello!'
52
+ * ```
47
53
  */
48
54
  export declare function TruncateString(str: string, maxLength: number, ellipsis?: string): string;
49
55
  /**
50
56
  * Pads a string to a specified length.
51
57
  *
52
- * @param str The input string.
53
- * @param length The target length.
54
- * @param char The character to pad with (default: ' ').
55
- * @param padEnd If true, pads the end; otherwise, pads the start (default: true).
56
- * @returns The padded string.
58
+ * @param str - The input string
59
+ * @param length - The target length
60
+ * @param char - The character to pad with (default: ' ')
61
+ * @param padEnd - If true, pads the end; otherwise, pads the start (default: true)
62
+ * @returns The padded string
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * PadString('hello', 10); // 'hello '
67
+ * PadString('hello', 10, '*'); // 'hello*****'
68
+ * PadString('hello', 10, '*', false); // '*****hello'
69
+ * ```
57
70
  */
58
71
  export declare function PadString(str: string, length: number, char?: string, padEnd?: boolean): string;
59
72
  /**
60
73
  * Removes all HTML tags from a string.
61
74
  *
62
- * @param str The input string.
63
- * @returns The string with all HTML tags stripped.
75
+ * @param str - The input string
76
+ * @returns The string with all HTML tags stripped
64
77
  *
65
78
  * @example
66
79
  * ```typescript
@@ -71,10 +84,10 @@ export declare function StripHTML(str: string): string;
71
84
  /**
72
85
  * Returns the plural form of a word based on a count.
73
86
  *
74
- * @param word The singular word.
75
- * @param count The count to test against.
76
- * @param plural Optional custom plural form (defaults to `word + 's'`).
77
- * @returns The singular word when `count === 1`, otherwise the plural.
87
+ * @param word - The singular word
88
+ * @param count - The count to test against
89
+ * @param plural - Optional custom plural form (defaults to `word + 's'`)
90
+ * @returns The singular word when `count === 1`, otherwise the plural
78
91
  *
79
92
  * @example
80
93
  * ```typescript
@@ -88,8 +101,8 @@ export declare function Pluralize(word: string, count: number, plural?: string):
88
101
  * Counts the number of words in a string.
89
102
  * Words are separated by one or more whitespace characters.
90
103
  *
91
- * @param str The input string.
92
- * @returns The number of words.
104
+ * @param str - The input string
105
+ * @returns The number of words
93
106
  *
94
107
  * @example
95
108
  * ```typescript
@@ -101,9 +114,9 @@ export declare function WordCount(str: string): number;
101
114
  /**
102
115
  * Counts the number of non-overlapping occurrences of `substr` in `str`.
103
116
  *
104
- * @param str The string to search in.
105
- * @param substr The substring to count.
106
- * @returns The number of occurrences.
117
+ * @param str - The string to search in
118
+ * @param substr - The substring to count
119
+ * @returns The number of occurrences
107
120
  *
108
121
  * @example
109
122
  * ```typescript
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src/string/formatting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAM7D;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAW9C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,aAAa,GAAG,WAAW,GACjC,MAAM,CAoBR;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,SAAQ,GAAG,MAAM,CAUvF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,SAAM,EAAE,MAAM,UAAO,GAAG,MAAM,CASxF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG7C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAG9E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG7C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CASpE"}
@@ -1,3 +1,6 @@
1
+ // Unicode flag (u) ensures consistent behavior with multi-byte characters (emoji, combining marks).
2
+ const INDEX_PLACEHOLDER_REGEX = /\{(\d+)\}/gu;
3
+ const KEY_PLACEHOLDER_REGEX = /\{(\w+)\}/gu;
1
4
  /**
2
5
  * Escapes a string for safe use in HTML by replacing special characters with
3
6
  * their HTML entity equivalents.
@@ -23,8 +26,8 @@ export function EscapeHTML(str) {
23
26
  return '';
24
27
  }
25
28
  /**
26
- * Formats a string by replacing placeholders with values
27
- * Supports both named placeholders {name} and positional {0}, {1}
29
+ * Formats a string by replacing placeholders with values.
30
+ * Supports both named placeholders {name} and positional {0}, {1}.
28
31
  *
29
32
  * @param template - The template string with placeholders
30
33
  * @param params - Either an object with named parameters or array of positional parameters
@@ -49,12 +52,12 @@ export function FormatString(template, params) {
49
52
  if (template && typeof template === 'string') {
50
53
  if (params && (Array.isArray(params) || typeof params === 'object')) {
51
54
  if (Array.isArray(params)) {
52
- return template.replace(/{(\d+)}/g, (match, index) => {
55
+ return template.replace(INDEX_PLACEHOLDER_REGEX, (match, index) => {
53
56
  const value = params[parseInt(index, 10)];
54
57
  return value !== undefined && value !== null ? String(value) : match;
55
58
  });
56
59
  }
57
- return template.replace(/{(\w+)}/g, (match, key) => {
60
+ return template.replace(KEY_PLACEHOLDER_REGEX, (match, key) => {
58
61
  const value = params[key];
59
62
  return value !== undefined && value !== null ? String(value) : match;
60
63
  });
@@ -66,10 +69,16 @@ export function FormatString(template, params) {
66
69
  /**
67
70
  * Truncates a string to a specified length, appending an ellipsis if truncated.
68
71
  *
69
- * @param str The string to truncate.
70
- * @param maxLength The maximum length before truncation.
71
- * @param ellipsis The string to append when truncated (default: '...').
72
- * @returns The truncated string.
72
+ * @param str - The string to truncate
73
+ * @param maxLength - The maximum length before truncation
74
+ * @param ellipsis - The string to append when truncated (default: '...')
75
+ * @returns The truncated string
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * TruncateString('Hello World', 5); // 'Hello...'
80
+ * TruncateString('Hello World', 5, '!'); // 'Hello!'
81
+ * ```
73
82
  */
74
83
  export function TruncateString(str, maxLength, ellipsis = '...') {
75
84
  if (str && typeof str === 'string' && maxLength > 0) {
@@ -83,11 +92,18 @@ export function TruncateString(str, maxLength, ellipsis = '...') {
83
92
  /**
84
93
  * Pads a string to a specified length.
85
94
  *
86
- * @param str The input string.
87
- * @param length The target length.
88
- * @param char The character to pad with (default: ' ').
89
- * @param padEnd If true, pads the end; otherwise, pads the start (default: true).
90
- * @returns The padded string.
95
+ * @param str - The input string
96
+ * @param length - The target length
97
+ * @param char - The character to pad with (default: ' ')
98
+ * @param padEnd - If true, pads the end; otherwise, pads the start (default: true)
99
+ * @returns The padded string
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * PadString('hello', 10); // 'hello '
104
+ * PadString('hello', 10, '*'); // 'hello*****'
105
+ * PadString('hello', 10, '*', false); // '*****hello'
106
+ * ```
91
107
  */
92
108
  export function PadString(str, length, char = ' ', padEnd = true) {
93
109
  if (typeof str === 'string' && length > str.length) {
@@ -100,8 +116,8 @@ export function PadString(str, length, char = ' ', padEnd = true) {
100
116
  /**
101
117
  * Removes all HTML tags from a string.
102
118
  *
103
- * @param str The input string.
104
- * @returns The string with all HTML tags stripped.
119
+ * @param str - The input string
120
+ * @returns The string with all HTML tags stripped
105
121
  *
106
122
  * @example
107
123
  * ```typescript
@@ -116,10 +132,10 @@ export function StripHTML(str) {
116
132
  /**
117
133
  * Returns the plural form of a word based on a count.
118
134
  *
119
- * @param word The singular word.
120
- * @param count The count to test against.
121
- * @param plural Optional custom plural form (defaults to `word + 's'`).
122
- * @returns The singular word when `count === 1`, otherwise the plural.
135
+ * @param word - The singular word
136
+ * @param count - The count to test against
137
+ * @param plural - Optional custom plural form (defaults to `word + 's'`)
138
+ * @returns The singular word when `count === 1`, otherwise the plural
123
139
  *
124
140
  * @example
125
141
  * ```typescript
@@ -137,8 +153,8 @@ export function Pluralize(word, count, plural) {
137
153
  * Counts the number of words in a string.
138
154
  * Words are separated by one or more whitespace characters.
139
155
  *
140
- * @param str The input string.
141
- * @returns The number of words.
156
+ * @param str - The input string
157
+ * @returns The number of words
142
158
  *
143
159
  * @example
144
160
  * ```typescript
@@ -154,9 +170,9 @@ export function WordCount(str) {
154
170
  /**
155
171
  * Counts the number of non-overlapping occurrences of `substr` in `str`.
156
172
  *
157
- * @param str The string to search in.
158
- * @param substr The substring to count.
159
- * @returns The number of occurrences.
173
+ * @param str - The string to search in
174
+ * @param substr - The substring to count
175
+ * @returns The number of occurrences
160
176
  *
161
177
  * @example
162
178
  * ```typescript
@@ -175,4 +191,3 @@ export function CountOccurrences(str, substr) {
175
191
  }
176
192
  return count;
177
193
  }
178
- //# sourceMappingURL=formatting.js.map
@@ -11,6 +11,7 @@ export * from './case-conversion.js';
11
11
  export * from './validation.js';
12
12
  export * from './formatting.js';
13
13
  export * from './transformation.js';
14
+ export * from './comparison.js';
14
15
  export type { TStringValidator, TStringFormatter, TStringTransformer, TCaseConverter, TStringPredicate, TFormatValue, TFormatParams, TFormatArgs } from './types.js';
15
16
  export * from './assert.js';
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/string/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AAEpC,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACrK,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/string/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAEhC,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACrK,cAAc,aAAa,CAAC"}
@@ -11,5 +11,5 @@ export * from './case-conversion.js';
11
11
  export * from './validation.js';
12
12
  export * from './formatting.js';
13
13
  export * from './transformation.js';
14
+ export * from './comparison.js';
14
15
  export * from './assert.js';
15
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Reverses a string.
3
+ *
4
+ * @param input - The input string
5
+ * @returns The reversed string
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * ReverseString('hello'); // 'olleh'
10
+ * ReverseString('12345'); // '54321'
11
+ * ```
12
+ */
13
+ export declare function ReverseString(input: string): string;
14
+ /**
15
+ * Converts a string to a URL-friendly slug.
16
+ *
17
+ * @param input - The input string
18
+ * @returns The URL-friendly slug
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * Slugify('Hello World!'); // 'hello-world'
23
+ * Slugify('The Quick Brown Fox'); // 'the-quick-brown-fox'
24
+ * Slugify('CamelCaseText'); // 'camelcasetext'
25
+ * ```
26
+ */
27
+ export declare function Slugify(input: string): string;
28
+ //# sourceMappingURL=transformation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformation.d.ts","sourceRoot":"","sources":["../../src/string/transformation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMnD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW7C"}