umt 2.16.0 → 2.18.0

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 (303) hide show
  1. package/README.md +344 -308
  2. package/module/Array/chunk.js.map +1 -1
  3. package/module/Array/uniqBy.js.map +1 -1
  4. package/module/Async/debounceAsync.d.ts +18 -0
  5. package/module/Async/debounceAsync.js +59 -0
  6. package/module/Async/debounceAsync.js.map +1 -0
  7. package/module/Async/index.d.ts +5 -0
  8. package/module/Async/index.js +5 -0
  9. package/module/Async/index.js.map +1 -1
  10. package/module/Async/pSettled.d.ts +19 -0
  11. package/module/Async/pSettled.js +54 -0
  12. package/module/Async/pSettled.js.map +1 -0
  13. package/module/Async/retry.d.ts +22 -0
  14. package/module/Async/retry.js +49 -0
  15. package/module/Async/retry.js.map +1 -0
  16. package/module/Async/throttleAsync.d.ts +18 -0
  17. package/module/Async/throttleAsync.js +41 -0
  18. package/module/Async/throttleAsync.js.map +1 -0
  19. package/module/Async/waitFor.d.ts +18 -0
  20. package/module/Async/waitFor.js +32 -0
  21. package/module/Async/waitFor.js.map +1 -0
  22. package/module/Date/addDuration.d.ts +15 -0
  23. package/module/Date/addDuration.js +40 -0
  24. package/module/Date/addDuration.js.map +1 -0
  25. package/module/Date/diff.d.ts +14 -0
  26. package/module/Date/diff.js +45 -0
  27. package/module/Date/diff.js.map +1 -0
  28. package/module/Date/durationUnit.d.ts +12 -0
  29. package/module/Date/durationUnit.js +2 -0
  30. package/module/Date/durationUnit.js.map +1 -0
  31. package/module/Date/endOf.d.ts +13 -0
  32. package/module/Date/endOf.js +58 -0
  33. package/module/Date/endOf.js.map +1 -0
  34. package/module/Date/formatRelative.d.ts +13 -0
  35. package/module/Date/formatRelative.js +35 -0
  36. package/module/Date/formatRelative.js.map +1 -0
  37. package/module/Date/index.d.ts +10 -0
  38. package/module/Date/index.js +10 -0
  39. package/module/Date/index.js.map +1 -1
  40. package/module/Date/isBusinessDay.d.ts +10 -0
  41. package/module/Date/isBusinessDay.js +18 -0
  42. package/module/Date/isBusinessDay.js.map +1 -0
  43. package/module/Date/isSameDay.d.ts +10 -0
  44. package/module/Date/isSameDay.js +13 -0
  45. package/module/Date/isSameDay.js.map +1 -0
  46. package/module/Date/isWeekend.d.ts +9 -0
  47. package/module/Date/isWeekend.js +13 -0
  48. package/module/Date/isWeekend.js.map +1 -0
  49. package/module/Date/msByUnit.d.ts +2 -0
  50. package/module/Date/msByUnit.js +10 -0
  51. package/module/Date/msByUnit.js.map +1 -0
  52. package/module/Date/startOf.d.ts +13 -0
  53. package/module/Date/startOf.js +58 -0
  54. package/module/Date/startOf.js.map +1 -0
  55. package/module/Date/subDuration.d.ts +13 -0
  56. package/module/Date/subDuration.js +14 -0
  57. package/module/Date/subDuration.js.map +1 -0
  58. package/module/Error/index.d.ts +0 -1
  59. package/module/Error/index.js +0 -1
  60. package/module/Error/index.js.map +1 -1
  61. package/module/Object/deepClone.js.map +1 -1
  62. package/module/Object/flattenObject.d.ts +11 -0
  63. package/module/Object/flattenObject.js +29 -0
  64. package/module/Object/flattenObject.js.map +1 -0
  65. package/module/Object/get.d.ts +1 -0
  66. package/module/Object/get.js +26 -0
  67. package/module/Object/get.js.map +1 -0
  68. package/module/Object/has.d.ts +0 -19
  69. package/module/Object/has.js +4 -4
  70. package/module/Object/has.js.map +1 -1
  71. package/module/Object/index.d.ts +8 -0
  72. package/module/Object/index.js +8 -0
  73. package/module/Object/index.js.map +1 -1
  74. package/module/Object/invert.d.ts +12 -0
  75. package/module/Object/invert.js +20 -0
  76. package/module/Object/invert.js.map +1 -0
  77. package/module/Object/mergeDeep.js.map +1 -1
  78. package/module/Object/omitBy.d.ts +11 -0
  79. package/module/Object/omitBy.js +21 -0
  80. package/module/Object/omitBy.js.map +1 -0
  81. package/module/Object/pathSegments.d.ts +1 -0
  82. package/module/Object/pathSegments.js +2 -0
  83. package/module/Object/pathSegments.js.map +1 -0
  84. package/module/Object/pickBy.d.ts +11 -0
  85. package/module/Object/pickBy.js +21 -0
  86. package/module/Object/pickBy.js.map +1 -0
  87. package/module/Object/set.d.ts +19 -0
  88. package/module/Object/set.js +38 -0
  89. package/module/Object/set.js.map +1 -0
  90. package/module/Object/unflattenObject.d.ts +15 -0
  91. package/module/Object/unflattenObject.js +23 -0
  92. package/module/Object/unflattenObject.js.map +1 -0
  93. package/module/Random/index.d.ts +7 -0
  94. package/module/Random/index.js +8 -0
  95. package/module/Random/index.js.map +1 -0
  96. package/module/Random/randomBoolean.d.ts +9 -0
  97. package/module/Random/randomBoolean.js +10 -0
  98. package/module/Random/randomBoolean.js.map +1 -0
  99. package/module/Random/randomChoice.d.ts +9 -0
  100. package/module/Random/randomChoice.js +13 -0
  101. package/module/Random/randomChoice.js.map +1 -0
  102. package/module/Random/randomFloat.d.ts +9 -0
  103. package/module/Random/randomFloat.js +10 -0
  104. package/module/Random/randomFloat.js.map +1 -0
  105. package/module/Random/randomInt.d.ts +9 -0
  106. package/module/Random/randomInt.js +14 -0
  107. package/module/Random/randomInt.js.map +1 -0
  108. package/module/Random/randomUuid.d.ts +9 -0
  109. package/module/Random/randomUuid.js +31 -0
  110. package/module/Random/randomUuid.js.map +1 -0
  111. package/module/Random/seededRandom.d.ts +11 -0
  112. package/module/Random/seededRandom.js +31 -0
  113. package/module/Random/seededRandom.js.map +1 -0
  114. package/module/Random/weightedChoice.d.ts +15 -0
  115. package/module/Random/weightedChoice.js +34 -0
  116. package/module/Random/weightedChoice.js.map +1 -0
  117. package/module/String/capitalize.d.ts +12 -0
  118. package/module/String/capitalize.js +18 -0
  119. package/module/String/capitalize.js.map +1 -0
  120. package/module/String/capitalizeWord.d.ts +1 -0
  121. package/module/String/capitalizeWord.js +2 -0
  122. package/module/String/capitalizeWord.js.map +1 -0
  123. package/module/String/dedent.d.ts +19 -0
  124. package/module/String/dedent.js +56 -0
  125. package/module/String/dedent.js.map +1 -0
  126. package/module/String/index.d.ts +10 -0
  127. package/module/String/index.js +10 -0
  128. package/module/String/index.js.map +1 -1
  129. package/module/String/mask.d.ts +20 -0
  130. package/module/String/mask.js +24 -0
  131. package/module/String/mask.js.map +1 -0
  132. package/module/String/pascalCase.d.ts +9 -0
  133. package/module/String/pascalCase.js +14 -0
  134. package/module/String/pascalCase.js.map +1 -0
  135. package/module/String/snakeCase.d.ts +9 -0
  136. package/module/String/snakeCase.js +13 -0
  137. package/module/String/snakeCase.js.map +1 -0
  138. package/module/String/titleCase.d.ts +9 -0
  139. package/module/String/titleCase.js +14 -0
  140. package/module/String/titleCase.js.map +1 -0
  141. package/module/String/uncapitalize.d.ts +10 -0
  142. package/module/String/uncapitalize.js +16 -0
  143. package/module/String/uncapitalize.js.map +1 -0
  144. package/module/String/wordCount.d.ts +10 -0
  145. package/module/String/wordCount.js +12 -0
  146. package/module/String/wordCount.js.map +1 -0
  147. package/module/String/words.d.ts +12 -0
  148. package/module/String/words.js +21 -0
  149. package/module/String/words.js.map +1 -0
  150. package/module/Tool/createPipeline.d.ts +1 -1
  151. package/module/Tool/createPipeline.js +8 -6
  152. package/module/Tool/createPipeline.js.map +1 -1
  153. package/module/Tool/pipe.js.map +1 -1
  154. package/module/URL/buildUrl.d.ts +10 -0
  155. package/module/URL/buildUrl.js +10 -4
  156. package/module/URL/buildUrl.js.map +1 -1
  157. package/module/URL/parseQueryString.d.ts +6 -0
  158. package/module/URL/parseQueryString.js +6 -4
  159. package/module/URL/parseQueryString.js.map +1 -1
  160. package/module/Validate/isNumber.js.map +1 -1
  161. package/module/Validate/object/core.js +0 -1
  162. package/module/Validate/object/core.js.map +1 -1
  163. package/module/Validate/object/index.d.ts +1 -0
  164. package/module/Validate/object/index.js +1 -0
  165. package/module/Validate/object/index.js.map +1 -1
  166. package/module/Validate/object/intersection.d.ts +4 -2
  167. package/module/Validate/object/intersection.js.map +1 -1
  168. package/module/Validate/object/nullable.d.ts +8 -0
  169. package/module/Validate/object/nullable.js +21 -0
  170. package/module/Validate/object/nullable.js.map +1 -0
  171. package/module/Validate/object/union.d.ts +4 -2
  172. package/module/Validate/object/union.js.map +1 -1
  173. package/module/Validate/string/index.d.ts +1 -0
  174. package/module/Validate/string/index.js +1 -0
  175. package/module/Validate/string/index.js.map +1 -1
  176. package/module/Validate/string/oneOf.d.ts +32 -0
  177. package/module/Validate/string/oneOf.js +32 -0
  178. package/module/Validate/string/oneOf.js.map +1 -0
  179. package/module/es5/Async/debounceAsync.d.ts +18 -0
  180. package/module/es5/Async/debounceAsync.js +103 -0
  181. package/module/es5/Async/index.d.ts +5 -0
  182. package/module/es5/Async/index.js +55 -0
  183. package/module/es5/Async/pSettled.d.ts +19 -0
  184. package/module/es5/Async/pSettled.js +68 -0
  185. package/module/es5/Async/retry.d.ts +22 -0
  186. package/module/es5/Async/retry.js +106 -0
  187. package/module/es5/Async/throttleAsync.d.ts +18 -0
  188. package/module/es5/Async/throttleAsync.js +46 -0
  189. package/module/es5/Async/waitFor.d.ts +18 -0
  190. package/module/es5/{Error/retry.js → Async/waitFor.js} +68 -74
  191. package/module/es5/Date/addDuration.d.ts +15 -0
  192. package/module/es5/Date/addDuration.js +45 -0
  193. package/module/es5/Date/diff.d.ts +14 -0
  194. package/module/es5/Date/diff.js +40 -0
  195. package/module/es5/Date/durationUnit.d.ts +12 -0
  196. package/module/es5/Date/durationUnit.js +5 -0
  197. package/module/es5/Date/endOf.d.ts +13 -0
  198. package/module/es5/Date/endOf.js +72 -0
  199. package/module/es5/Date/formatRelative.d.ts +13 -0
  200. package/module/es5/Date/formatRelative.js +61 -0
  201. package/module/es5/Date/index.d.ts +10 -0
  202. package/module/es5/Date/index.js +110 -0
  203. package/module/es5/Date/isBusinessDay.d.ts +10 -0
  204. package/module/es5/Date/isBusinessDay.js +26 -0
  205. package/module/es5/Date/isSameDay.d.ts +10 -0
  206. package/module/es5/Date/isSameDay.js +18 -0
  207. package/module/es5/Date/isWeekend.d.ts +9 -0
  208. package/module/es5/Date/isWeekend.js +18 -0
  209. package/module/es5/Date/msByUnit.d.ts +2 -0
  210. package/module/es5/Date/msByUnit.js +15 -0
  211. package/module/es5/Date/startOf.d.ts +13 -0
  212. package/module/es5/Date/startOf.js +72 -0
  213. package/module/es5/Date/subDuration.d.ts +13 -0
  214. package/module/es5/Date/subDuration.js +21 -0
  215. package/module/es5/Error/index.d.ts +0 -1
  216. package/module/es5/Error/index.js +0 -11
  217. package/module/es5/Object/flattenObject.d.ts +11 -0
  218. package/module/es5/Object/flattenObject.js +35 -0
  219. package/module/es5/Object/get.d.ts +1 -0
  220. package/module/es5/Object/get.js +42 -0
  221. package/module/es5/Object/has.d.ts +0 -19
  222. package/module/es5/Object/has.js +4 -4
  223. package/module/es5/Object/index.d.ts +8 -0
  224. package/module/es5/Object/index.js +88 -0
  225. package/module/es5/Object/invert.d.ts +12 -0
  226. package/module/es5/Object/invert.js +26 -0
  227. package/module/es5/Object/omitBy.d.ts +11 -0
  228. package/module/es5/Object/omitBy.js +27 -0
  229. package/module/es5/Object/pathSegments.d.ts +1 -0
  230. package/module/es5/Object/pathSegments.js +9 -0
  231. package/module/es5/Object/pickBy.d.ts +11 -0
  232. package/module/es5/Object/pickBy.js +27 -0
  233. package/module/es5/Object/set.d.ts +19 -0
  234. package/module/es5/Object/set.js +44 -0
  235. package/module/es5/Object/unflattenObject.d.ts +15 -0
  236. package/module/es5/Object/unflattenObject.js +30 -0
  237. package/module/es5/Random/index.d.ts +7 -0
  238. package/module/es5/Random/index.js +82 -0
  239. package/module/es5/Random/randomBoolean.d.ts +9 -0
  240. package/module/es5/Random/randomBoolean.js +18 -0
  241. package/module/es5/Random/randomChoice.d.ts +9 -0
  242. package/module/es5/Random/randomChoice.js +18 -0
  243. package/module/es5/Random/randomFloat.d.ts +9 -0
  244. package/module/es5/Random/randomFloat.js +17 -0
  245. package/module/es5/Random/randomInt.d.ts +9 -0
  246. package/module/es5/Random/randomInt.js +19 -0
  247. package/module/es5/Random/randomUuid.d.ts +9 -0
  248. package/module/es5/Random/randomUuid.js +38 -0
  249. package/module/es5/Random/seededRandom.d.ts +11 -0
  250. package/module/es5/Random/seededRandom.js +46 -0
  251. package/module/es5/Random/weightedChoice.d.ts +15 -0
  252. package/module/es5/Random/weightedChoice.js +50 -0
  253. package/module/es5/String/capitalize.d.ts +12 -0
  254. package/module/es5/String/capitalize.js +35 -0
  255. package/module/es5/String/capitalizeWord.d.ts +1 -0
  256. package/module/es5/String/capitalizeWord.js +9 -0
  257. package/module/es5/String/dedent.d.ts +19 -0
  258. package/module/es5/String/dedent.js +82 -0
  259. package/module/es5/String/index.d.ts +10 -0
  260. package/module/es5/String/index.js +110 -0
  261. package/module/es5/String/mask.d.ts +20 -0
  262. package/module/es5/String/mask.js +39 -0
  263. package/module/es5/String/pascalCase.d.ts +9 -0
  264. package/module/es5/String/pascalCase.js +21 -0
  265. package/module/es5/String/snakeCase.d.ts +9 -0
  266. package/module/es5/String/snakeCase.js +20 -0
  267. package/module/es5/String/titleCase.d.ts +9 -0
  268. package/module/es5/String/titleCase.js +21 -0
  269. package/module/es5/String/uncapitalize.d.ts +10 -0
  270. package/module/es5/String/uncapitalize.js +33 -0
  271. package/module/es5/String/wordCount.d.ts +10 -0
  272. package/module/es5/String/wordCount.js +19 -0
  273. package/module/es5/String/words.d.ts +12 -0
  274. package/module/es5/String/words.js +25 -0
  275. package/module/es5/Tool/createPipeline.d.ts +1 -1
  276. package/module/es5/Tool/createPipeline.js +7 -10
  277. package/module/es5/URL/buildUrl.d.ts +10 -0
  278. package/module/es5/URL/buildUrl.js +10 -4
  279. package/module/es5/URL/parseQueryString.d.ts +6 -0
  280. package/module/es5/URL/parseQueryString.js +6 -4
  281. package/module/es5/Validate/object/core.js +0 -1
  282. package/module/es5/Validate/object/index.d.ts +1 -0
  283. package/module/es5/Validate/object/index.js +11 -0
  284. package/module/es5/Validate/object/intersection.d.ts +4 -2
  285. package/module/es5/Validate/object/intersection.js +6 -0
  286. package/module/es5/Validate/object/nullable.d.ts +8 -0
  287. package/module/es5/Validate/object/nullable.js +26 -0
  288. package/module/es5/Validate/object/union.d.ts +4 -2
  289. package/module/es5/Validate/object/union.js +6 -0
  290. package/module/es5/Validate/string/index.d.ts +1 -0
  291. package/module/es5/Validate/string/index.js +11 -0
  292. package/module/es5/Validate/string/oneOf.d.ts +32 -0
  293. package/module/es5/Validate/string/oneOf.js +45 -0
  294. package/module/es5/index.d.ts +1 -0
  295. package/module/es5/index.js +20 -9
  296. package/module/index.d.ts +1 -0
  297. package/module/index.js +1 -0
  298. package/module/index.js.map +1 -1
  299. package/package.json +33 -25
  300. package/module/Error/retry.d.ts +0 -37
  301. package/module/Error/retry.js +0 -47
  302. package/module/Error/retry.js.map +0 -1
  303. package/module/es5/Error/retry.d.ts +0 -37
@@ -1,4 +1,7 @@
1
1
  export * from "./camelCase";
2
+ export * from "./capitalize";
3
+ export * from "./capitalizeWord";
4
+ export * from "./dedent";
2
5
  export * from "./deleteSpaces";
3
6
  export * from "./escapeHtml";
4
7
  export * from "./formatString";
@@ -7,18 +10,25 @@ export * from "./fuzzySearch";
7
10
  export * from "./hasNoLetters";
8
11
  export * from "./kebabCase";
9
12
  export * from "./levenshteinDistance";
13
+ export * from "./mask";
10
14
  export * from "./padEnd";
11
15
  export * from "./padStart";
16
+ export * from "./pascalCase";
12
17
  export * from "./randomString";
13
18
  export * from "./randomStringInitialization";
14
19
  export * from "./reverseString";
15
20
  export * from "./slugify";
21
+ export * from "./snakeCase";
16
22
  export * from "./stringSimilarity";
23
+ export * from "./titleCase";
17
24
  export * from "./toBase64";
18
25
  export * from "./toHalfWidth";
19
26
  export * from "./trimCharacters";
20
27
  export * from "./trimEndCharacters";
21
28
  export * from "./trimStartCharacters";
22
29
  export * from "./truncate";
30
+ export * from "./uncapitalize";
23
31
  export * from "./unescapeHtml";
32
+ export * from "./wordCount";
33
+ export * from "./words";
24
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/String/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,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AC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ export interface MaskOptions {
2
+ /** Number of leading characters to keep visible. Default: 1 */
3
+ start?: number;
4
+ /** Number of trailing characters to keep visible. Default: 1 */
5
+ end?: number;
6
+ /** Mask character. Default: "*" */
7
+ char?: string;
8
+ }
9
+ /**
10
+ * Masks the middle portion of a string with a fill character, preserving the
11
+ * leading and trailing visible counts. Surrogate-pair safe.
12
+ *
13
+ * @param {string} string_ - Input string
14
+ * @param {MaskOptions} [options] - Visible-character counts and mask char
15
+ * @returns {string} Masked string
16
+ * @example
17
+ * mask("1234567890", { start: 2, end: 4 }); // "12****7890"
18
+ * mask("secret"); // "s****t"
19
+ */
20
+ export declare const mask: (string_: string, options?: MaskOptions) => string;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Masks the middle portion of a string with a fill character, preserving the
3
+ * leading and trailing visible counts. Surrogate-pair safe.
4
+ *
5
+ * @param {string} string_ - Input string
6
+ * @param {MaskOptions} [options] - Visible-character counts and mask char
7
+ * @returns {string} Masked string
8
+ * @example
9
+ * mask("1234567890", { start: 2, end: 4 }); // "12****7890"
10
+ * mask("secret"); // "s****t"
11
+ */
12
+ export const mask = (string_, options = {}) => {
13
+ const { start = 1, end = 1, char = "*" } = options;
14
+ const graphemes = [...string_];
15
+ const length = graphemes.length;
16
+ if (start + end >= length) {
17
+ return string_;
18
+ }
19
+ const middleLength = length - start - end;
20
+ return (graphemes.slice(0, start).join("") +
21
+ char.repeat(middleLength) +
22
+ graphemes.slice(length - end).join(""));
23
+ };
24
+ //# sourceMappingURL=mask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mask.js","sourceRoot":"","sources":["../../src/String/mask.ts"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,OAAe,EAAE,UAAuB,EAAE,EAAU,EAAE;IACzE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,IAAI,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,SAAS,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAChC,IAAI,KAAK,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,GAAG,CAAC;IAC1C,OAAO,CACL,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;QACzB,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CACvC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Converts a string to PascalCase.
3
+ * @param {string} string_ - Input string
4
+ * @returns {string} PascalCase string
5
+ * @example
6
+ * pascalCase("hello-world"); // "HelloWorld"
7
+ * pascalCase("hello_world"); // "HelloWorld"
8
+ */
9
+ export declare const pascalCase: (string_: string) => string;
@@ -0,0 +1,14 @@
1
+ import { capitalizeWord } from "./capitalizeWord";
2
+ import { words } from "./words";
3
+ /**
4
+ * Converts a string to PascalCase.
5
+ * @param {string} string_ - Input string
6
+ * @returns {string} PascalCase string
7
+ * @example
8
+ * pascalCase("hello-world"); // "HelloWorld"
9
+ * pascalCase("hello_world"); // "HelloWorld"
10
+ */
11
+ export const pascalCase = (string_) => words(string_)
12
+ .map((word) => capitalizeWord(word))
13
+ .join("");
14
+ //# sourceMappingURL=pascalCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pascalCase.js","sourceRoot":"","sources":["../../src/String/pascalCase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAe,EAAU,EAAE,CACpD,KAAK,CAAC,OAAO,CAAC;KACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;KACnC,IAAI,CAAC,EAAE,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Converts a string to snake_case.
3
+ * @param {string} string_ - Input string
4
+ * @returns {string} snake_case string
5
+ * @example
6
+ * snakeCase("helloWorld"); // "hello_world"
7
+ * snakeCase("Hello World"); // "hello_world"
8
+ */
9
+ export declare const snakeCase: (string_: string) => string;
@@ -0,0 +1,13 @@
1
+ import { words } from "./words";
2
+ /**
3
+ * Converts a string to snake_case.
4
+ * @param {string} string_ - Input string
5
+ * @returns {string} snake_case string
6
+ * @example
7
+ * snakeCase("helloWorld"); // "hello_world"
8
+ * snakeCase("Hello World"); // "hello_world"
9
+ */
10
+ export const snakeCase = (string_) => words(string_)
11
+ .map((word) => word.toLowerCase())
12
+ .join("_");
13
+ //# sourceMappingURL=snakeCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snakeCase.js","sourceRoot":"","sources":["../../src/String/snakeCase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAU,EAAE,CACnD,KAAK,CAAC,OAAO,CAAC;KACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;KACjC,IAAI,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Converts a string to Title Case (each word capitalized, separated by spaces).
3
+ * @param {string} string_ - Input string
4
+ * @returns {string} Title Case string
5
+ * @example
6
+ * titleCase("hello world"); // "Hello World"
7
+ * titleCase("a-quick brown_fox"); // "A Quick Brown Fox"
8
+ */
9
+ export declare const titleCase: (string_: string) => string;
@@ -0,0 +1,14 @@
1
+ import { capitalizeWord } from "./capitalizeWord";
2
+ import { words } from "./words";
3
+ /**
4
+ * Converts a string to Title Case (each word capitalized, separated by spaces).
5
+ * @param {string} string_ - Input string
6
+ * @returns {string} Title Case string
7
+ * @example
8
+ * titleCase("hello world"); // "Hello World"
9
+ * titleCase("a-quick brown_fox"); // "A Quick Brown Fox"
10
+ */
11
+ export const titleCase = (string_) => words(string_)
12
+ .map((word) => capitalizeWord(word))
13
+ .join(" ");
14
+ //# sourceMappingURL=titleCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"titleCase.js","sourceRoot":"","sources":["../../src/String/titleCase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAU,EAAE,CACnD,KAAK,CAAC,OAAO,CAAC;KACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;KACnC,IAAI,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Lowercases the first grapheme of a string. Surrogate-pair safe.
3
+ *
4
+ * @param {string} string_ - Input string
5
+ * @returns {string} String with the first grapheme lowercased
6
+ * @example
7
+ * uncapitalize("Hello"); // "hello"
8
+ * uncapitalize("ÉCLAIR"); // "éCLAIR"
9
+ */
10
+ export declare const uncapitalize: (string_: string) => string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Lowercases the first grapheme of a string. Surrogate-pair safe.
3
+ *
4
+ * @param {string} string_ - Input string
5
+ * @returns {string} String with the first grapheme lowercased
6
+ * @example
7
+ * uncapitalize("Hello"); // "hello"
8
+ * uncapitalize("ÉCLAIR"); // "éCLAIR"
9
+ */
10
+ export const uncapitalize = (string_) => {
11
+ for (const first of string_) {
12
+ return first.toLowerCase() + string_.slice(first.length);
13
+ }
14
+ return string_;
15
+ };
16
+ //# sourceMappingURL=uncapitalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uncapitalize.js","sourceRoot":"","sources":["../../src/String/uncapitalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAe,EAAU,EAAE;IACtD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Counts words in a string using the same boundaries as `words`.
3
+ *
4
+ * @param {string} string_ - Input string
5
+ * @returns {number} Word count
6
+ * @example
7
+ * wordCount("hello world"); // 2
8
+ * wordCount("camelCase split"); // 3
9
+ */
10
+ export declare const wordCount: (string_: string) => number;
@@ -0,0 +1,12 @@
1
+ import { words } from "./words";
2
+ /**
3
+ * Counts words in a string using the same boundaries as `words`.
4
+ *
5
+ * @param {string} string_ - Input string
6
+ * @returns {number} Word count
7
+ * @example
8
+ * wordCount("hello world"); // 2
9
+ * wordCount("camelCase split"); // 3
10
+ */
11
+ export const wordCount = (string_) => words(string_).length;
12
+ //# sourceMappingURL=wordCount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wordCount.js","sourceRoot":"","sources":["../../src/String/wordCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Splits a string into words on case boundaries and non-alphanumeric separators.
3
+ * Uses Unicode property escapes so CJK and other letters are preserved.
4
+ *
5
+ * @param {string} string_ - Input string
6
+ * @param {RegExp} [pattern] - Custom matching pattern; defaults to a Unicode word matcher
7
+ * @returns {string[]} Array of words
8
+ * @example
9
+ * words("helloWorld foo-bar"); // ["hello", "World", "foo", "bar"]
10
+ * words("XMLHttpRequest"); // ["XML", "Http", "Request"]
11
+ */
12
+ export declare const words: (string_: string, pattern?: RegExp) => string[];
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Splits a string into words on case boundaries and non-alphanumeric separators.
3
+ * Uses Unicode property escapes so CJK and other letters are preserved.
4
+ *
5
+ * @param {string} string_ - Input string
6
+ * @param {RegExp} [pattern] - Custom matching pattern; defaults to a Unicode word matcher
7
+ * @returns {string[]} Array of words
8
+ * @example
9
+ * words("helloWorld foo-bar"); // ["hello", "World", "foo", "bar"]
10
+ * words("XMLHttpRequest"); // ["XML", "Http", "Request"]
11
+ */
12
+ export const words = (string_, pattern) => {
13
+ if (pattern) {
14
+ return string_.match(pattern) ?? [];
15
+ }
16
+ const withBoundaries = string_
17
+ .replaceAll(/([\p{Ll}\p{N}])(\p{Lu})/gu, "$1 $2")
18
+ .replaceAll(/(\p{Lu})(\p{Lu}\p{Ll})/gu, "$1 $2");
19
+ return withBoundaries.split(/[^\p{L}\p{N}]+/u).filter(Boolean);
20
+ };
21
+ //# sourceMappingURL=words.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"words.js","sourceRoot":"","sources":["../../src/String/words.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAe,EAAE,OAAgB,EAAY,EAAE;IACnE,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC;IACD,MAAM,cAAc,GAAG,OAAO;SAC3B,UAAU,CAAC,2BAA2B,EAAE,OAAO,CAAC;SAChD,UAAU,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC,CAAC"}
@@ -17,4 +17,4 @@ export interface Pipeline<T> {
17
17
  * pipeline(); // 1
18
18
  * pipeline((x) => x + 1)(); // 2
19
19
  */
20
- export declare const createPipeline: <T>(initialValue: T) => Pipeline<T>;
20
+ export declare function createPipeline<T>(initialValue: T): Pipeline<T>;
@@ -7,10 +7,12 @@
7
7
  * pipeline(); // 1
8
8
  * pipeline((x) => x + 1)(); // 2
9
9
  */
10
- export const createPipeline = (initialValue) =>
11
- // Accepts a transformer function as an argument and returns a new Pipeline.
12
- // If no argument is provided, returns the stored value (initialValue).
13
- ((transformer) => transformer
14
- ? createPipeline(transformer(initialValue))
15
- : initialValue);
10
+ export function createPipeline(initialValue) {
11
+ function pipeline(transformer) {
12
+ return transformer
13
+ ? createPipeline(transformer(initialValue))
14
+ : initialValue;
15
+ }
16
+ return pipeline;
17
+ }
16
18
  //# sourceMappingURL=createPipeline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createPipeline.js","sourceRoot":"","sources":["../../src/Tool/createPipeline.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAwC,CACjE,YAAe,EACf,EAAE;AACF,4EAA4E;AAC5E,uEAAuE;AACvE,CAAC,CAAI,WAA6B,EAAE,EAAE,CACpC,WAAW;IACT,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAC3C,CAAC,CAAC,YAAY,CAAgB,CAAC"}
1
+ {"version":3,"file":"createPipeline.js","sourceRoot":"","sources":["../../src/Tool/createPipeline.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAI,YAAe;IAG/C,SAAS,QAAQ,CAAI,WAA6B;QAChD,OAAO,WAAW;YAChB,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YAC3C,CAAC,CAAC,YAAY,CAAC;IACnB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"pipe.js","sourceRoot":"","sources":["../../src/Tool/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,qBAAqB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,OAAO,IAAI;IAIc;IAH7B;;OAEG;IACH,YAA6B,KAAQ;QAAR,UAAK,GAAL,KAAK,CAAG;IAAG,CAAC;IAEzC;;;;OAIG;IACH,GAAG,CAAI,SAA0B;QAC/B,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACH,IAAI,CACF,SAAgC,EAChC,SAA0B;QAE1B,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;YAC1B,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAyB,CAAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,SAA6B;QAC/B,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,OAAO,IAAI,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,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,GAAG;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAI,YAAe;IACrC,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;AAChC,CAAC"}
@@ -5,6 +5,16 @@
5
5
  * @param params - An object of key-value pairs to append as query parameters
6
6
  * @returns The complete URL string with query parameters
7
7
  *
8
+ * @remarks
9
+ * **Prototype pollution warning:** This function does not filter out
10
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
11
+ * If processing user-controlled input, sanitize with the appropriate
12
+ * `removePrototype*` helper before calling this function:
13
+ * - `removePrototype` — shallow sanitization of a single object
14
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
15
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
16
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
17
+ *
8
18
  * @example
9
19
  * ```typescript
10
20
  * buildUrl("https://example.com", { page: "1", q: "search" });
@@ -5,6 +5,16 @@
5
5
  * @param params - An object of key-value pairs to append as query parameters
6
6
  * @returns The complete URL string with query parameters
7
7
  *
8
+ * @remarks
9
+ * **Prototype pollution warning:** This function does not filter out
10
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
11
+ * If processing user-controlled input, sanitize with the appropriate
12
+ * `removePrototype*` helper before calling this function:
13
+ * - `removePrototype` — shallow sanitization of a single object
14
+ * - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
15
+ * - `removePrototypeMap` — shallow sanitization of an array of objects
16
+ * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
17
+ *
8
18
  * @example
9
19
  * ```typescript
10
20
  * buildUrl("https://example.com", { page: "1", q: "search" });
@@ -17,10 +27,6 @@
17
27
  export const buildUrl = (base, parameters = {}) => {
18
28
  const url = new URL(base);
19
29
  for (const key of Object.keys(parameters)) {
20
- // Prevent prototype pollution by rejecting dangerous keys
21
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
22
- continue;
23
- }
24
30
  url.searchParams.append(key, parameters[key]);
25
31
  }
26
32
  return url.toString();
@@ -1 +1 @@
1
- {"version":3,"file":"buildUrl.js","sourceRoot":"","sources":["../../src/URL/buildUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,IAAY,EACZ,aAAqC,EAAE,EAC/B,EAAE;IACV,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1C,0DAA0D;QAC1D,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,aAAa,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;YACxE,SAAS;QACX,CAAC;QACD,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC,CAAC"}
1
+ {"version":3,"file":"buildUrl.js","sourceRoot":"","sources":["../../src/URL/buildUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,IAAY,EACZ,aAAqC,EAAE,EAC/B,EAAE;IACV,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1C,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC,CAAC"}
@@ -7,6 +7,12 @@
7
7
  * @param query - The query string or URL to parse
8
8
  * @returns A record of key-value pairs from the query string
9
9
  *
10
+ * @remarks
11
+ * **Prototype pollution warning:** This function does not filter out
12
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
13
+ * If processing user-controlled input, sanitize the result with
14
+ * `removePrototype` after calling this function.
15
+ *
10
16
  * @example
11
17
  * ```typescript
12
18
  * parseQueryString("?page=1&q=search");
@@ -7,6 +7,12 @@
7
7
  * @param query - The query string or URL to parse
8
8
  * @returns A record of key-value pairs from the query string
9
9
  *
10
+ * @remarks
11
+ * **Prototype pollution warning:** This function does not filter out
12
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
13
+ * If processing user-controlled input, sanitize the result with
14
+ * `removePrototype` after calling this function.
15
+ *
10
16
  * @example
11
17
  * ```typescript
12
18
  * parseQueryString("?page=1&q=search");
@@ -27,10 +33,6 @@ export const parseQueryString = (query) => {
27
33
  const parameters = new URLSearchParams(searchString);
28
34
  const result = {};
29
35
  for (const [key, value] of parameters) {
30
- // Prevent prototype pollution by rejecting dangerous keys
31
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
32
- continue;
33
- }
34
36
  result[key] = value;
35
37
  }
36
38
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"parseQueryString.js","sourceRoot":"","sources":["../../src/URL/parseQueryString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA0B,EAAE;IACxE,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,YAAY,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IACvC,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,UAAU,EAAE,CAAC;QACtC,0DAA0D;QAC1D,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,aAAa,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;YACxE,SAAS;QACX,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
1
+ {"version":3,"file":"parseQueryString.js","sourceRoot":"","sources":["../../src/URL/parseQueryString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA0B,EAAE;IACxE,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,YAAY,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IACvC,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,UAAU,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"isNumber.js","sourceRoot":"","sources":["../../src/Validate/isNumber.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,QAAQ,GAAG,CACf,MAAe,EACf,QAAW,IAAS,EACiC,EAAE;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,SAAS,IAAI,KAAK;QAC5D,CAAC,CAAC,wDAAwD;YACxD,QAAQ,CAAC,MAAgB,CAAC;QAC5B,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAgB,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"isNumber.js","sourceRoot":"","sources":["../../src/Validate/isNumber.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,QAAQ,GAAG,CACf,MAAe,EACf,QAAW,IAAS,EACiC,EAAE;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,SAAS,IAAI,KAAK;QAC5D,CAAC,CAAC,wDAAwD;YACxD,QAAQ,CAAC,MAAgB,CAAC;QAC5B,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -16,7 +16,6 @@ export const object = (option = {}, message) => {
16
16
  return {
17
17
  validate: false,
18
18
  message: message ?? "",
19
- // biome-ignore lint/suspicious/noExplicitAny: Type assertion needed for return type compatibility
20
19
  type: value,
21
20
  };
22
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/object/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,kBAAkB,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,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,KAAK;aACZ,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE,CAAC;YAC9B,6EAA6E;YAC7E,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAE,KAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;gBACzD,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,6EAA6E;oBAC7E,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAY,CAAC,CAAC,OAAO;oBAC/C,kGAAkG;oBAClG,IAAI,EAAE,KAAY;iBACnB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,kGAAkG;YAClG,IAAI,EAAE,KAAY;SACnB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from "./core";
2
2
  export * from "./intersection";
3
+ export * from "./nullable";
3
4
  export * from "./optional";
4
5
  export * from "./union";
@@ -1,5 +1,6 @@
1
1
  export * from "./core";
2
2
  export * from "./intersection";
3
+ export * from "./nullable";
3
4
  export * from "./optional";
4
5
  export * from "./union";
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/object/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/object/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import type { UnionToIntersection } from "../../types/logic";
2
- import type { ValidateCoreReturnType } from "../../Validate/type";
3
- type ExtractValidatedType<V> = V extends (value: never) => ValidateCoreReturnType<infer T> ? T : never;
2
+ import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
3
+ type ExtractValidatedType<V> = V extends (value: never) => {
4
+ type: infer T;
5
+ } ? ValidateType<T> : never;
4
6
  /**
5
7
  * Creates an intersection validator that passes only if all given validators pass
6
8
  * @param validators - Validator functions to compose as an intersection (logical AND)
@@ -1 +1 @@
1
- {"version":3,"file":"intersection.js","sourceRoot":"","sources":["../../../src/Validate/object/intersection.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAG1B,GAAG,UAAmB,EACtB,EAAE;IACF,OAAO,CACL,KAA4D,EAG5D,EAAE;QACF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,MAAM,GACV,SAKD,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACrB,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,IAAI,EAAE,KAEL;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAEL;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"intersection.js","sourceRoot":"","sources":["../../../src/Validate/object/intersection.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAG1B,GAAG,UAAmB,EACtB,EAAE;IACF,OAAO,CACL,KAA4D,EAG5D,EAAE;QACF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,MAAM,GACV,SAKD,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACrB,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,IAAI,EAAE,KAEL;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAEL;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ValidateCoreReturnType } from "../../Validate/type";
2
+ /**
3
+ * Wraps a validator to accept null values
4
+ * @template T - The type of value the wrapped validator expects
5
+ * @param {Function} validator - Validator function to make nullable
6
+ * @returns {Function} - Validator that passes for null or delegates to the wrapped validator
7
+ */
8
+ export declare const nullable: <T>(validator: (value: T) => ValidateCoreReturnType<T>) => ((value: T | null) => ValidateCoreReturnType<T | null>);
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Wraps a validator to accept null values
3
+ * @template T - The type of value the wrapped validator expects
4
+ * @param {Function} validator - Validator function to make nullable
5
+ * @returns {Function} - Validator that passes for null or delegates to the wrapped validator
6
+ */
7
+ export const nullable = (validator) => {
8
+ const nullableValidator = (value) => {
9
+ if (value === null) {
10
+ return {
11
+ validate: true,
12
+ message: "",
13
+ type: "null",
14
+ };
15
+ }
16
+ const result = validator(value);
17
+ return result;
18
+ };
19
+ return nullableValidator;
20
+ };
21
+ //# sourceMappingURL=nullable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../src/Validate/object/nullable.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,SAAkD,EACO,EAAE;IAC3D,MAAM,iBAAiB,GAAG,CACxB,KAAe,EACmB,EAAE;QACpC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,IAAI,EAAE,MAAM;aACb,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAChC,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC"}
@@ -1,5 +1,7 @@
1
- import type { ValidateCoreReturnType } from "../../Validate/type";
2
- type ExtractValidatedType<V> = V extends (value: never) => ValidateCoreReturnType<infer T> ? T : never;
1
+ import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
2
+ type ExtractValidatedType<V> = V extends (value: never) => {
3
+ type: infer T;
4
+ } ? ValidateType<T> : never;
3
5
  /**
4
6
  * Creates a union validator that passes if any of the given validators pass
5
7
  * @param validators - Validator functions to compose as a union (logical OR)
@@ -1 +1 @@
1
- {"version":3,"file":"union.js","sourceRoot":"","sources":["../../../src/Validate/object/union.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAGnB,GAAG,UAAmB,EACtB,EAAE;IACF,OAAO,CACL,KAAuC,EACmB,EAAE;QAC5D,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,MAAM,GACV,SAGD,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACpB,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,IAAI,EAAE,KAA2D;iBAClE,CAAC;YACJ,CAAC;YACD,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE,KAA2D;SAClE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"union.js","sourceRoot":"","sources":["../../../src/Validate/object/union.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAGnB,GAAG,UAAmB,EACtB,EAAE;IACF,OAAO,CACL,KAAuC,EACmB,EAAE;QAC5D,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,MAAM,GACV,SAGD,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACpB,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,IAAI,EAAE,KAA2D;iBAClE,CAAC;YACJ,CAAC;YACD,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE,KAA2D;SAClE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -4,5 +4,6 @@ export * from "./length";
4
4
  export * from "./minLength";
5
5
  export * from "./maxLength";
6
6
  export * from "./numberString";
7
+ export * from "./oneOf";
7
8
  export * from "./regexMatch";
8
9
  export * from "./uuid";
@@ -4,6 +4,7 @@ export * from "./length";
4
4
  export * from "./minLength";
5
5
  export * from "./maxLength";
6
6
  export * from "./numberString";
7
+ export * from "./oneOf";
7
8
  export * from "./regexMatch";
8
9
  export * from "./uuid";
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/string/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/string/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * String validation module for literal union (allowed values) check
3
+ * Provides validation functionality for checking if a string is one of the
4
+ * allowed literal values, useful for validating string literal union types
5
+ * such as `'standard' | 'squat' | 'decanter' | 'round' | 'tall' | 'flask'`.
6
+ *
7
+ * The validator's return type carries the literal union through its `type`
8
+ * field directly (instead of going through `Types<T>` which would collapse
9
+ * to `"string"`), so consumers like `object()`, `union()`, and `intersection()`
10
+ * can preserve the literal union in their inferred types.
11
+ */
12
+ /**
13
+ * Return type produced by a `oneOf` validator. Structurally compatible with
14
+ * `ValidateCoreReturnType<unknown>`, but exposes the literal union directly
15
+ * via the `type` field so the inferred type can flow through `object()`,
16
+ * `union()`, and `intersection()` without being collapsed to `string`.
17
+ */
18
+ export interface OneOfReturnType<T extends string> {
19
+ validate: boolean;
20
+ message: string;
21
+ type: T;
22
+ }
23
+ /**
24
+ * Creates a top-level validator that checks if a string value is one of the
25
+ * given allowed literal values. The literal union is captured via `const T`
26
+ * and exposed through the `OneOfReturnType<T[number]>` return type.
27
+ * @template T - The tuple of allowed string literals
28
+ * @param {T} values - The tuple of allowed string values
29
+ * @param {string} [message] - Custom error message for validation failure
30
+ * @returns A validator function from `string` to `OneOfReturnType<T[number]>`
31
+ */
32
+ export declare const oneOf: <const T extends readonly string[]>(values: T, message?: string) => (value: string) => OneOfReturnType<T[number]>;