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
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Sets a value at a deeply nested path on an object, mutating it.
3
+ * Creates intermediate objects as needed.
4
+ *
5
+ * @template T - Type of the source object
6
+ * @param {T} object - Target object (mutated)
7
+ * @param {string | string[]} path - Dot-separated string or path segments array
8
+ * @param {unknown} value - Value to assign at the path
9
+ * @returns {T} The same object reference, for chaining
10
+ *
11
+ * @remarks
12
+ * **Prototype pollution warning:** This function does not filter out
13
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
14
+ * Sanitize user-controlled paths before calling.
15
+ *
16
+ * @example
17
+ * set({}, "a.b.c", 1); // { a: { b: { c: 1 } } }
18
+ */
19
+ export declare const set: <T extends object>(object: T, path: string | string[], value: unknown) => T;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.set = void 0;
7
+ var _pathSegments = require("./pathSegments");
8
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
9
+ /**
10
+ * Sets a value at a deeply nested path on an object, mutating it.
11
+ * Creates intermediate objects as needed.
12
+ *
13
+ * @template T - Type of the source object
14
+ * @param {T} object - Target object (mutated)
15
+ * @param {string | string[]} path - Dot-separated string or path segments array
16
+ * @param {unknown} value - Value to assign at the path
17
+ * @returns {T} The same object reference, for chaining
18
+ *
19
+ * @remarks
20
+ * **Prototype pollution warning:** This function does not filter out
21
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
22
+ * Sanitize user-controlled paths before calling.
23
+ *
24
+ * @example
25
+ * set({}, "a.b.c", 1); // { a: { b: { c: 1 } } }
26
+ */
27
+ var set = exports.set = function set(object, path, value) {
28
+ var segments = (0, _pathSegments.pathSegments)(path);
29
+ if (segments.length === 0) {
30
+ return object;
31
+ }
32
+ var current = object;
33
+ for (var index = 0; index < segments.length - 1; index += 1) {
34
+ var key = segments[index];
35
+ var next = current[key];
36
+ if (next == null || _typeof(next) !== "object") {
37
+ current[key] = {};
38
+ }
39
+ current = current[key];
40
+ }
41
+ var lastIndex = segments.length - 1;
42
+ current[segments[lastIndex]] = value;
43
+ return object;
44
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Reconstructs a nested object from a flat path-keyed object.
3
+ *
4
+ * @param {Record<string, unknown>} flat - Flat input keyed by joined paths
5
+ * @param {string} [separator="."] - Separator used in path keys
6
+ * @returns {Record<string, unknown>} A nested object
7
+ *
8
+ * @remarks
9
+ * **Prototype pollution warning:** Internally uses `set`, which does not
10
+ * filter out prototype-polluting keys. Sanitize user-controlled keys.
11
+ *
12
+ * @example
13
+ * unflattenObject({ "a.b.c": 1, d: 2 }); // { a: { b: { c: 1 } }, d: 2 }
14
+ */
15
+ export declare const unflattenObject: (flat: Record<string, unknown>, separator?: string) => Record<string, unknown>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.unflattenObject = void 0;
7
+ var _set = require("./set");
8
+ /**
9
+ * Reconstructs a nested object from a flat path-keyed object.
10
+ *
11
+ * @param {Record<string, unknown>} flat - Flat input keyed by joined paths
12
+ * @param {string} [separator="."] - Separator used in path keys
13
+ * @returns {Record<string, unknown>} A nested object
14
+ *
15
+ * @remarks
16
+ * **Prototype pollution warning:** Internally uses `set`, which does not
17
+ * filter out prototype-polluting keys. Sanitize user-controlled keys.
18
+ *
19
+ * @example
20
+ * unflattenObject({ "a.b.c": 1, d: 2 }); // { a: { b: { c: 1 } }, d: 2 }
21
+ */
22
+ var unflattenObject = exports.unflattenObject = function unflattenObject(flat) {
23
+ var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ".";
24
+ var result = {};
25
+ for (var _i = 0, _Object$keys = Object.keys(flat); _i < _Object$keys.length; _i++) {
26
+ var key = _Object$keys[_i];
27
+ (0, _set.set)(result, key.split(separator), flat[key]);
28
+ }
29
+ return result;
30
+ };
@@ -0,0 +1,7 @@
1
+ export * from "./randomBoolean";
2
+ export * from "./randomChoice";
3
+ export * from "./randomFloat";
4
+ export * from "./randomInt";
5
+ export * from "./randomUuid";
6
+ export * from "./seededRandom";
7
+ export * from "./weightedChoice";
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _randomBoolean = require("./randomBoolean");
7
+ Object.keys(_randomBoolean).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _randomBoolean[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _randomBoolean[key];
14
+ }
15
+ });
16
+ });
17
+ var _randomChoice = require("./randomChoice");
18
+ Object.keys(_randomChoice).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _randomChoice[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _randomChoice[key];
25
+ }
26
+ });
27
+ });
28
+ var _randomFloat = require("./randomFloat");
29
+ Object.keys(_randomFloat).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _randomFloat[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _randomFloat[key];
36
+ }
37
+ });
38
+ });
39
+ var _randomInt = require("./randomInt");
40
+ Object.keys(_randomInt).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _randomInt[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function get() {
46
+ return _randomInt[key];
47
+ }
48
+ });
49
+ });
50
+ var _randomUuid = require("./randomUuid");
51
+ Object.keys(_randomUuid).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _randomUuid[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function get() {
57
+ return _randomUuid[key];
58
+ }
59
+ });
60
+ });
61
+ var _seededRandom = require("./seededRandom");
62
+ Object.keys(_seededRandom).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _seededRandom[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function get() {
68
+ return _seededRandom[key];
69
+ }
70
+ });
71
+ });
72
+ var _weightedChoice = require("./weightedChoice");
73
+ Object.keys(_weightedChoice).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _weightedChoice[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function get() {
79
+ return _weightedChoice[key];
80
+ }
81
+ });
82
+ });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns a random boolean. The probability of `true` defaults to 0.5.
3
+ * @param {number} [probability=0.5] - Probability of returning true (0..1)
4
+ * @returns {boolean} Random boolean
5
+ * @example
6
+ * randomBoolean(); // true or false equally
7
+ * randomBoolean(0.9); // true ~90% of the time
8
+ */
9
+ export declare const randomBoolean: (probability?: number) => boolean;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.randomBoolean = void 0;
7
+ /**
8
+ * Returns a random boolean. The probability of `true` defaults to 0.5.
9
+ * @param {number} [probability=0.5] - Probability of returning true (0..1)
10
+ * @returns {boolean} Random boolean
11
+ * @example
12
+ * randomBoolean(); // true or false equally
13
+ * randomBoolean(0.9); // true ~90% of the time
14
+ */
15
+ var randomBoolean = exports.randomBoolean = function randomBoolean() {
16
+ var probability = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.5;
17
+ return Math.random() < probability;
18
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns a uniformly random element from the input array.
3
+ * @template T - Element type
4
+ * @param {readonly T[]} items - Source array (must be non-empty)
5
+ * @returns {T} A randomly selected element
6
+ * @example
7
+ * randomChoice(["a", "b", "c"]);
8
+ */
9
+ export declare const randomChoice: <T>(items: readonly T[]) => T;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.randomChoice = void 0;
7
+ /**
8
+ * Returns a uniformly random element from the input array.
9
+ * @template T - Element type
10
+ * @param {readonly T[]} items - Source array (must be non-empty)
11
+ * @returns {T} A randomly selected element
12
+ * @example
13
+ * randomChoice(["a", "b", "c"]);
14
+ */
15
+ var randomChoice = exports.randomChoice = function randomChoice(items) {
16
+ var index = Math.floor(Math.random() * items.length);
17
+ return items[index];
18
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns a random float in the half-open interval `[min, max)`.
3
+ * @param {number} min - Inclusive lower bound
4
+ * @param {number} max - Exclusive upper bound
5
+ * @returns {number} Random float
6
+ * @example
7
+ * randomFloat(0, 1); // 0.000... up to but not including 1
8
+ */
9
+ export declare const randomFloat: (min: number, max: number) => number;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.randomFloat = void 0;
7
+ /**
8
+ * Returns a random float in the half-open interval `[min, max)`.
9
+ * @param {number} min - Inclusive lower bound
10
+ * @param {number} max - Exclusive upper bound
11
+ * @returns {number} Random float
12
+ * @example
13
+ * randomFloat(0, 1); // 0.000... up to but not including 1
14
+ */
15
+ var randomFloat = exports.randomFloat = function randomFloat(min, max) {
16
+ return Math.random() * (max - min) + min;
17
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns a random integer in the closed interval `[min, max]`.
3
+ * @param {number} min - Inclusive lower bound
4
+ * @param {number} max - Inclusive upper bound
5
+ * @returns {number} Random integer
6
+ * @example
7
+ * randomInt(1, 6); // 1, 2, 3, 4, 5, or 6
8
+ */
9
+ export declare const randomInt: (min: number, max: number) => number;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.randomInt = void 0;
7
+ /**
8
+ * Returns a random integer in the closed interval `[min, max]`.
9
+ * @param {number} min - Inclusive lower bound
10
+ * @param {number} max - Inclusive upper bound
11
+ * @returns {number} Random integer
12
+ * @example
13
+ * randomInt(1, 6); // 1, 2, 3, 4, 5, or 6
14
+ */
15
+ var randomInt = exports.randomInt = function randomInt(min, max) {
16
+ var lo = Math.ceil(min);
17
+ var hi = Math.floor(max);
18
+ return Math.floor(Math.random() * (hi - lo + 1)) + lo;
19
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Generates a UUID v4 string. Uses `crypto.randomUUID` when available,
3
+ * otherwise falls back to `crypto.getRandomValues`.
4
+ *
5
+ * @returns {string} A UUID v4 in canonical 8-4-4-4-12 hex form
6
+ * @example
7
+ * randomUUID(); // e.g. "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed"
8
+ */
9
+ export declare const randomUUID: () => string;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.randomUUID = void 0;
7
+ var DIGITS = "0123456789abcdef";
8
+ var bytesToUuid = function bytesToUuid(bytes) {
9
+ var result = "";
10
+ for (var index = 0; index < 16; index += 1) {
11
+ if (index === 4 || index === 6 || index === 8 || index === 10) {
12
+ result += "-";
13
+ }
14
+ var _byte = bytes[index];
15
+ result += DIGITS[_byte >>> 4] + DIGITS[_byte & 0xf];
16
+ }
17
+ return result;
18
+ };
19
+
20
+ /**
21
+ * Generates a UUID v4 string. Uses `crypto.randomUUID` when available,
22
+ * otherwise falls back to `crypto.getRandomValues`.
23
+ *
24
+ * @returns {string} A UUID v4 in canonical 8-4-4-4-12 hex form
25
+ * @example
26
+ * randomUUID(); // e.g. "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed"
27
+ */
28
+ var randomUUID = exports.randomUUID = function randomUUID() {
29
+ var _globalThis$crypto;
30
+ if (typeof ((_globalThis$crypto = globalThis.crypto) === null || _globalThis$crypto === void 0 ? void 0 : _globalThis$crypto.randomUUID) === "function") {
31
+ return globalThis.crypto.randomUUID();
32
+ }
33
+ var bytes = new Uint8Array(16);
34
+ globalThis.crypto.getRandomValues(bytes);
35
+ bytes[6] = bytes[6] & 0x0f | 0x40;
36
+ bytes[8] = bytes[8] & 0x3f | 0x80;
37
+ return bytesToUuid(bytes);
38
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Returns a deterministic PRNG seeded from a number or string. Each call
3
+ * produces a float in `[0, 1)` from the same xoshiro256** stream.
4
+ *
5
+ * @param {number | string} seed - Seed value
6
+ * @returns {() => number} A function that returns sequential pseudo-random floats
7
+ * @example
8
+ * const rand = seededRandom("hello");
9
+ * rand(); // deterministic for the same seed
10
+ */
11
+ export declare const seededRandom: (seed: number | string) => (() => number);
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.seededRandom = void 0;
7
+ var _xoshiro = require("../Math/xoshiro256");
8
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
9
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
+ var TEXT_ENCODER = new TextEncoder();
12
+ var hashStringToSeed = function hashStringToSeed(input) {
13
+ var hash = 2166136261;
14
+ var _iterator = _createForOfIteratorHelper(TEXT_ENCODER.encode(input)),
15
+ _step;
16
+ try {
17
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
18
+ var _byte = _step.value;
19
+ hash ^= _byte;
20
+ hash = Math.imul(hash, 16777619);
21
+ }
22
+ } catch (err) {
23
+ _iterator.e(err);
24
+ } finally {
25
+ _iterator.f();
26
+ }
27
+ return hash >>> 0;
28
+ };
29
+
30
+ /**
31
+ * Returns a deterministic PRNG seeded from a number or string. Each call
32
+ * produces a float in `[0, 1)` from the same xoshiro256** stream.
33
+ *
34
+ * @param {number | string} seed - Seed value
35
+ * @returns {() => number} A function that returns sequential pseudo-random floats
36
+ * @example
37
+ * const rand = seededRandom("hello");
38
+ * rand(); // deterministic for the same seed
39
+ */
40
+ var seededRandom = exports.seededRandom = function seededRandom(seed) {
41
+ var initial = typeof seed === "number" ? seed >>> 0 : hashStringToSeed(seed);
42
+ var state = [initial || 1, Math.imul(initial, 0x9e3779b9) >>> 0 || 2, Math.imul(initial, 0x85ebca6b) >>> 0 || 3, Math.imul(initial, 0xc2b2ae35) >>> 0 || 4];
43
+ return function () {
44
+ return (0, _xoshiro.xoshiro256)(state);
45
+ };
46
+ };
@@ -0,0 +1,15 @@
1
+ export interface WeightedItem<T> {
2
+ value: T;
3
+ weight: number;
4
+ }
5
+ /**
6
+ * Returns a random element using cumulative weights and binary search.
7
+ * Items with non-positive weights are skipped from the pool.
8
+ *
9
+ * @template T - Element type
10
+ * @param {readonly WeightedItem<T>[]} items - Items with non-negative weights
11
+ * @returns {T} A randomly selected element
12
+ * @example
13
+ * weightedChoice([{ value: "a", weight: 1 }, { value: "b", weight: 4 }]);
14
+ */
15
+ export declare const weightedChoice: <T>(items: readonly WeightedItem<T>[]) => T;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.weightedChoice = void 0;
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ /**
11
+ * Returns a random element using cumulative weights and binary search.
12
+ * Items with non-positive weights are skipped from the pool.
13
+ *
14
+ * @template T - Element type
15
+ * @param {readonly WeightedItem<T>[]} items - Items with non-negative weights
16
+ * @returns {T} A randomly selected element
17
+ * @example
18
+ * weightedChoice([{ value: "a", weight: 1 }, { value: "b", weight: 4 }]);
19
+ */
20
+ var weightedChoice = exports.weightedChoice = function weightedChoice(items) {
21
+ var cumulative = [];
22
+ var total = 0;
23
+ var _iterator = _createForOfIteratorHelper(items),
24
+ _step;
25
+ try {
26
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
27
+ var item = _step.value;
28
+ if (item.weight > 0) {
29
+ total += item.weight;
30
+ }
31
+ cumulative.push(total);
32
+ }
33
+ } catch (err) {
34
+ _iterator.e(err);
35
+ } finally {
36
+ _iterator.f();
37
+ }
38
+ var target = Math.random() * total;
39
+ var lo = 0;
40
+ var hi = cumulative.length - 1;
41
+ while (lo < hi) {
42
+ var mid = lo + hi >>> 1;
43
+ if (cumulative[mid] <= target) {
44
+ lo = mid + 1;
45
+ } else {
46
+ hi = mid;
47
+ }
48
+ }
49
+ return items[lo].value;
50
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Capitalizes the first grapheme of a string. Surrogate-pair safe.
3
+ * Does not lowercase the rest of the string.
4
+ *
5
+ * @param {string} string_ - Input string
6
+ * @returns {string} String with the first grapheme uppercased
7
+ * @example
8
+ * capitalize("hello"); // "Hello"
9
+ * capitalize("éclair"); // "Éclair"
10
+ * capitalize(""); // ""
11
+ */
12
+ export declare const capitalize: (string_: string) => string;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.capitalize = void 0;
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ /**
11
+ * Capitalizes the first grapheme of a string. Surrogate-pair safe.
12
+ * Does not lowercase the rest of the string.
13
+ *
14
+ * @param {string} string_ - Input string
15
+ * @returns {string} String with the first grapheme uppercased
16
+ * @example
17
+ * capitalize("hello"); // "Hello"
18
+ * capitalize("éclair"); // "Éclair"
19
+ * capitalize(""); // ""
20
+ */
21
+ var capitalize = exports.capitalize = function capitalize(string_) {
22
+ var _iterator = _createForOfIteratorHelper(string_),
23
+ _step;
24
+ try {
25
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
26
+ var first = _step.value;
27
+ return first.toUpperCase() + string_.slice(first.length);
28
+ }
29
+ } catch (err) {
30
+ _iterator.e(err);
31
+ } finally {
32
+ _iterator.f();
33
+ }
34
+ return string_;
35
+ };
@@ -0,0 +1 @@
1
+ export declare const capitalizeWord: (word: string) => string;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.capitalizeWord = void 0;
7
+ var capitalizeWord = exports.capitalizeWord = function capitalizeWord(word) {
8
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
9
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Removes the minimum common leading whitespace from each line of the input.
3
+ * Works as a plain function or as a tagged template literal.
4
+ *
5
+ * @param {string | TemplateStringsArray} string_ - Input string or template strings array
6
+ * @param {...unknown[]} values - Interpolated values when used as a tag
7
+ * @returns {string} Dedented string
8
+ * @example
9
+ * dedent(`
10
+ * line1
11
+ * line2
12
+ * `); // "\nline1\n line2\n"
13
+ *
14
+ * @example
15
+ * dedent`
16
+ * value: ${1}
17
+ * `; // "\nvalue: 1\n"
18
+ */
19
+ export declare const dedent: (string_: string | TemplateStringsArray, ...values: unknown[]) => string;