umt 2.16.0 → 2.17.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 (275) hide show
  1. package/README.md +42 -0
  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/es5/Async/debounceAsync.d.ts +18 -0
  164. package/module/es5/Async/debounceAsync.js +103 -0
  165. package/module/es5/Async/index.d.ts +5 -0
  166. package/module/es5/Async/index.js +55 -0
  167. package/module/es5/Async/pSettled.d.ts +19 -0
  168. package/module/es5/Async/pSettled.js +68 -0
  169. package/module/es5/Async/retry.d.ts +22 -0
  170. package/module/es5/Async/retry.js +106 -0
  171. package/module/es5/Async/throttleAsync.d.ts +18 -0
  172. package/module/es5/Async/throttleAsync.js +46 -0
  173. package/module/es5/Async/waitFor.d.ts +18 -0
  174. package/module/es5/{Error/retry.js → Async/waitFor.js} +68 -74
  175. package/module/es5/Date/addDuration.d.ts +15 -0
  176. package/module/es5/Date/addDuration.js +45 -0
  177. package/module/es5/Date/diff.d.ts +14 -0
  178. package/module/es5/Date/diff.js +40 -0
  179. package/module/es5/Date/durationUnit.d.ts +12 -0
  180. package/module/es5/Date/durationUnit.js +5 -0
  181. package/module/es5/Date/endOf.d.ts +13 -0
  182. package/module/es5/Date/endOf.js +72 -0
  183. package/module/es5/Date/formatRelative.d.ts +13 -0
  184. package/module/es5/Date/formatRelative.js +61 -0
  185. package/module/es5/Date/index.d.ts +10 -0
  186. package/module/es5/Date/index.js +110 -0
  187. package/module/es5/Date/isBusinessDay.d.ts +10 -0
  188. package/module/es5/Date/isBusinessDay.js +26 -0
  189. package/module/es5/Date/isSameDay.d.ts +10 -0
  190. package/module/es5/Date/isSameDay.js +18 -0
  191. package/module/es5/Date/isWeekend.d.ts +9 -0
  192. package/module/es5/Date/isWeekend.js +18 -0
  193. package/module/es5/Date/msByUnit.d.ts +2 -0
  194. package/module/es5/Date/msByUnit.js +15 -0
  195. package/module/es5/Date/startOf.d.ts +13 -0
  196. package/module/es5/Date/startOf.js +72 -0
  197. package/module/es5/Date/subDuration.d.ts +13 -0
  198. package/module/es5/Date/subDuration.js +21 -0
  199. package/module/es5/Error/index.d.ts +0 -1
  200. package/module/es5/Error/index.js +0 -11
  201. package/module/es5/Object/flattenObject.d.ts +11 -0
  202. package/module/es5/Object/flattenObject.js +35 -0
  203. package/module/es5/Object/get.d.ts +1 -0
  204. package/module/es5/Object/get.js +42 -0
  205. package/module/es5/Object/has.d.ts +0 -19
  206. package/module/es5/Object/has.js +4 -4
  207. package/module/es5/Object/index.d.ts +8 -0
  208. package/module/es5/Object/index.js +88 -0
  209. package/module/es5/Object/invert.d.ts +12 -0
  210. package/module/es5/Object/invert.js +26 -0
  211. package/module/es5/Object/omitBy.d.ts +11 -0
  212. package/module/es5/Object/omitBy.js +27 -0
  213. package/module/es5/Object/pathSegments.d.ts +1 -0
  214. package/module/es5/Object/pathSegments.js +9 -0
  215. package/module/es5/Object/pickBy.d.ts +11 -0
  216. package/module/es5/Object/pickBy.js +27 -0
  217. package/module/es5/Object/set.d.ts +19 -0
  218. package/module/es5/Object/set.js +44 -0
  219. package/module/es5/Object/unflattenObject.d.ts +15 -0
  220. package/module/es5/Object/unflattenObject.js +30 -0
  221. package/module/es5/Random/index.d.ts +7 -0
  222. package/module/es5/Random/index.js +82 -0
  223. package/module/es5/Random/randomBoolean.d.ts +9 -0
  224. package/module/es5/Random/randomBoolean.js +18 -0
  225. package/module/es5/Random/randomChoice.d.ts +9 -0
  226. package/module/es5/Random/randomChoice.js +18 -0
  227. package/module/es5/Random/randomFloat.d.ts +9 -0
  228. package/module/es5/Random/randomFloat.js +17 -0
  229. package/module/es5/Random/randomInt.d.ts +9 -0
  230. package/module/es5/Random/randomInt.js +19 -0
  231. package/module/es5/Random/randomUuid.d.ts +9 -0
  232. package/module/es5/Random/randomUuid.js +38 -0
  233. package/module/es5/Random/seededRandom.d.ts +11 -0
  234. package/module/es5/Random/seededRandom.js +46 -0
  235. package/module/es5/Random/weightedChoice.d.ts +15 -0
  236. package/module/es5/Random/weightedChoice.js +50 -0
  237. package/module/es5/String/capitalize.d.ts +12 -0
  238. package/module/es5/String/capitalize.js +35 -0
  239. package/module/es5/String/capitalizeWord.d.ts +1 -0
  240. package/module/es5/String/capitalizeWord.js +9 -0
  241. package/module/es5/String/dedent.d.ts +19 -0
  242. package/module/es5/String/dedent.js +82 -0
  243. package/module/es5/String/index.d.ts +10 -0
  244. package/module/es5/String/index.js +110 -0
  245. package/module/es5/String/mask.d.ts +20 -0
  246. package/module/es5/String/mask.js +39 -0
  247. package/module/es5/String/pascalCase.d.ts +9 -0
  248. package/module/es5/String/pascalCase.js +21 -0
  249. package/module/es5/String/snakeCase.d.ts +9 -0
  250. package/module/es5/String/snakeCase.js +20 -0
  251. package/module/es5/String/titleCase.d.ts +9 -0
  252. package/module/es5/String/titleCase.js +21 -0
  253. package/module/es5/String/uncapitalize.d.ts +10 -0
  254. package/module/es5/String/uncapitalize.js +33 -0
  255. package/module/es5/String/wordCount.d.ts +10 -0
  256. package/module/es5/String/wordCount.js +19 -0
  257. package/module/es5/String/words.d.ts +12 -0
  258. package/module/es5/String/words.js +25 -0
  259. package/module/es5/Tool/createPipeline.d.ts +1 -1
  260. package/module/es5/Tool/createPipeline.js +7 -10
  261. package/module/es5/URL/buildUrl.d.ts +10 -0
  262. package/module/es5/URL/buildUrl.js +10 -4
  263. package/module/es5/URL/parseQueryString.d.ts +6 -0
  264. package/module/es5/URL/parseQueryString.js +6 -4
  265. package/module/es5/Validate/object/core.js +0 -1
  266. package/module/es5/index.d.ts +1 -0
  267. package/module/es5/index.js +20 -9
  268. package/module/index.d.ts +1 -0
  269. package/module/index.js +1 -0
  270. package/module/index.js.map +1 -1
  271. package/package.json +30 -25
  272. package/module/Error/retry.d.ts +0 -37
  273. package/module/Error/retry.js +0 -47
  274. package/module/Error/retry.js.map +0 -1
  275. package/module/es5/Error/retry.d.ts +0 -37
@@ -1,7 +1,10 @@
1
1
  export * from "./deepClone";
2
+ export * from "./flattenObject";
3
+ export * from "./get";
2
4
  export * from "./getObjectsCommon";
3
5
  export * from "./getObjectsDiff";
4
6
  export * from "./has";
7
+ export * from "./invert";
5
8
  export * from "./isEmpty";
6
9
  export * from "./isPlainObject";
7
10
  export * from "./keyBy";
@@ -10,10 +13,15 @@ export * from "./mapValues";
10
13
  export * from "./merge";
11
14
  export * from "./mergeDeep";
12
15
  export * from "./omit";
16
+ export * from "./omitBy";
17
+ export * from "./pathSegments";
13
18
  export * from "./pick";
19
+ export * from "./pickBy";
14
20
  export * from "./pickDeep";
15
21
  export * from "./removePrototype";
16
22
  export * from "./removePrototypeDeep";
17
23
  export * from "./removePrototypeMap";
18
24
  export * from "./removePrototypeMapDeep";
25
+ export * from "./set";
26
+ export * from "./unflattenObject";
19
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Object/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Object/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,OAAO,CAAC;AACtB,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Creates a new object with keys and values swapped.
3
+ * If multiple keys share the same value, later entries overwrite earlier ones.
4
+ *
5
+ * @template K - Key type of the input object (must be a PropertyKey)
6
+ * @template V - Value type of the input object (must be a PropertyKey)
7
+ * @param {Record<K, V>} object - Source object
8
+ * @returns {Record<V, K>} A new object with keys and values swapped
9
+ * @example
10
+ * invert({ a: 1, b: 2 }); // { 1: "a", 2: "b" }
11
+ */
12
+ export declare const invert: <K extends PropertyKey, V extends PropertyKey>(object: Record<K, V>) => Record<V, K>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Creates a new object with keys and values swapped.
3
+ * If multiple keys share the same value, later entries overwrite earlier ones.
4
+ *
5
+ * @template K - Key type of the input object (must be a PropertyKey)
6
+ * @template V - Value type of the input object (must be a PropertyKey)
7
+ * @param {Record<K, V>} object - Source object
8
+ * @returns {Record<V, K>} A new object with keys and values swapped
9
+ * @example
10
+ * invert({ a: 1, b: 2 }); // { 1: "a", 2: "b" }
11
+ */
12
+ export const invert = (object) => {
13
+ const result = {};
14
+ for (const key of Object.keys(object)) {
15
+ const value = object[key];
16
+ result[value] = key;
17
+ }
18
+ return result;
19
+ };
20
+ //# sourceMappingURL=invert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invert.js","sourceRoot":"","sources":["../../src/Object/invert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,MAAoB,EACN,EAAE;IAChB,MAAM,MAAM,GAAG,EAAkB,CAAC;IAClC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAQ,EAAE,CAAC;QAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CA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a,CAAC,WAAW,CAAC;wBACtD,CAAC,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;wBAC1D,CAAC,CAAC,WAAW,CAAC;YACpB,CAAC;QACH,CAAC;QAED,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,EAAE,WAAW,GAAG,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,iBAAiB,CAAC,MAAW,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,EAAE,WAAW,GAAG,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAIvB,MAAS,EACT,GAAG,OAAU,EACuB,EAAE;IACtC,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Creates a new object containing only entries for which the predicate returns false.
3
+ *
4
+ * @template T - Type of the source object
5
+ * @param {T} object - Source object
6
+ * @param {(value: T[keyof T], key: keyof T) => boolean} predicate - Rejection predicate
7
+ * @returns {Partial<T>} A new object with the remaining entries
8
+ * @example
9
+ * omitBy({ a: 1, b: undefined, c: 3 }, (v) => v === undefined); // { a: 1, c: 3 }
10
+ */
11
+ export declare const omitBy: <T extends Record<string, unknown>>(object: T, predicate: (value: T[keyof T], key: keyof T) => boolean) => Partial<T>;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Creates a new object containing only entries for which the predicate returns false.
3
+ *
4
+ * @template T - Type of the source object
5
+ * @param {T} object - Source object
6
+ * @param {(value: T[keyof T], key: keyof T) => boolean} predicate - Rejection predicate
7
+ * @returns {Partial<T>} A new object with the remaining entries
8
+ * @example
9
+ * omitBy({ a: 1, b: undefined, c: 3 }, (v) => v === undefined); // { a: 1, c: 3 }
10
+ */
11
+ export const omitBy = (object, predicate) => {
12
+ const result = {};
13
+ for (const key of Object.keys(object)) {
14
+ const value = object[key];
15
+ if (!predicate(value, key)) {
16
+ result[key] = value;
17
+ }
18
+ }
19
+ return result;
20
+ };
21
+ //# sourceMappingURL=omitBy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"omitBy.js","sourceRoot":"","sources":["../../src/Object/omitBy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,MAAS,EACT,SAAuD,EAC3C,EAAE;IACd,MAAM,MAAM,GAAe,EAAE,CAAC;IAC9B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAgB,EAAE,CAAC;QACrD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const pathSegments: (path: string | string[]) => string[];
@@ -0,0 +1,2 @@
1
+ export const pathSegments = (path) => typeof path === "string" ? path.split(".") : path;
2
+ //# sourceMappingURL=pathSegments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathSegments.js","sourceRoot":"","sources":["../../src/Object/pathSegments.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAuB,EAAY,EAAE,CAChE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Creates a new object containing only entries for which the predicate returns true.
3
+ *
4
+ * @template T - Type of the source object
5
+ * @param {T} object - Source object
6
+ * @param {(value: T[keyof T], key: keyof T) => boolean} predicate - Selector predicate
7
+ * @returns {Partial<T>} A new object with the filtered entries
8
+ * @example
9
+ * pickBy({ a: 1, b: 2, c: 3 }, (v) => v > 1); // { b: 2, c: 3 }
10
+ */
11
+ export declare const pickBy: <T extends Record<string, unknown>>(object: T, predicate: (value: T[keyof T], key: keyof T) => boolean) => Partial<T>;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Creates a new object containing only entries for which the predicate returns true.
3
+ *
4
+ * @template T - Type of the source object
5
+ * @param {T} object - Source object
6
+ * @param {(value: T[keyof T], key: keyof T) => boolean} predicate - Selector predicate
7
+ * @returns {Partial<T>} A new object with the filtered entries
8
+ * @example
9
+ * pickBy({ a: 1, b: 2, c: 3 }, (v) => v > 1); // { b: 2, c: 3 }
10
+ */
11
+ export const pickBy = (object, predicate) => {
12
+ const result = {};
13
+ for (const key of Object.keys(object)) {
14
+ const value = object[key];
15
+ if (predicate(value, key)) {
16
+ result[key] = value;
17
+ }
18
+ }
19
+ return result;
20
+ };
21
+ //# sourceMappingURL=pickBy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pickBy.js","sourceRoot":"","sources":["../../src/Object/pickBy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,MAAS,EACT,SAAuD,EAC3C,EAAE;IACd,MAAM,MAAM,GAAe,EAAE,CAAC;IAC9B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAgB,EAAE,CAAC;QACrD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -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,38 @@
1
+ import { pathSegments } from "./pathSegments";
2
+ /**
3
+ * Sets a value at a deeply nested path on an object, mutating it.
4
+ * Creates intermediate objects as needed.
5
+ *
6
+ * @template T - Type of the source object
7
+ * @param {T} object - Target object (mutated)
8
+ * @param {string | string[]} path - Dot-separated string or path segments array
9
+ * @param {unknown} value - Value to assign at the path
10
+ * @returns {T} The same object reference, for chaining
11
+ *
12
+ * @remarks
13
+ * **Prototype pollution warning:** This function does not filter out
14
+ * prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
15
+ * Sanitize user-controlled paths before calling.
16
+ *
17
+ * @example
18
+ * set({}, "a.b.c", 1); // { a: { b: { c: 1 } } }
19
+ */
20
+ export const set = (object, path, value) => {
21
+ const segments = pathSegments(path);
22
+ if (segments.length === 0) {
23
+ return object;
24
+ }
25
+ let current = object;
26
+ for (let index = 0; index < segments.length - 1; index += 1) {
27
+ const key = segments[index];
28
+ const next = current[key];
29
+ if (next == null || typeof next !== "object") {
30
+ current[key] = {};
31
+ }
32
+ current = current[key];
33
+ }
34
+ const lastIndex = segments.length - 1;
35
+ current[segments[lastIndex]] = value;
36
+ return object;
37
+ };
38
+ //# sourceMappingURL=set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.js","sourceRoot":"","sources":["../../src/Object/set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CACjB,MAAS,EACT,IAAuB,EACvB,KAAc,EACX,EAAE;IACL,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,IAAI,OAAO,GAA4B,MAAiC,CAAC;IACzE,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC5D,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7C,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;QACpB,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,GAAG,CAA4B,CAAC;IACpD,CAAC;IACD,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC;IACrC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -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,23 @@
1
+ import { set } from "./set";
2
+ /**
3
+ * Reconstructs a nested object from a flat path-keyed object.
4
+ *
5
+ * @param {Record<string, unknown>} flat - Flat input keyed by joined paths
6
+ * @param {string} [separator="."] - Separator used in path keys
7
+ * @returns {Record<string, unknown>} A nested object
8
+ *
9
+ * @remarks
10
+ * **Prototype pollution warning:** Internally uses `set`, which does not
11
+ * filter out prototype-polluting keys. Sanitize user-controlled keys.
12
+ *
13
+ * @example
14
+ * unflattenObject({ "a.b.c": 1, d: 2 }); // { a: { b: { c: 1 } }, d: 2 }
15
+ */
16
+ export const unflattenObject = (flat, separator = ".") => {
17
+ const result = {};
18
+ for (const key of Object.keys(flat)) {
19
+ set(result, key.split(separator), flat[key]);
20
+ }
21
+ return result;
22
+ };
23
+ //# sourceMappingURL=unflattenObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unflattenObject.js","sourceRoot":"","sources":["../../src/Object/unflattenObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,IAA6B,EAC7B,SAAS,GAAG,GAAG,EACU,EAAE;IAC3B,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -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,8 @@
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";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Random/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
@@ -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,10 @@
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 const randomBoolean = (probability = 0.5) => Math.random() < probability;
10
+ //# sourceMappingURL=randomBoolean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomBoolean.js","sourceRoot":"","sources":["../../src/Random/randomBoolean.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,WAAW,GAAG,GAAG,EAAW,EAAE,CAC1D,IAAI,CAAC,MAAM,EAAE,GAAG,WAAW,CAAC"}
@@ -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,13 @@
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 const randomChoice = (items) => {
10
+ const index = Math.floor(Math.random() * items.length);
11
+ return items[index];
12
+ };
13
+ //# sourceMappingURL=randomChoice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomChoice.js","sourceRoot":"","sources":["../../src/Random/randomChoice.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAI,KAAmB,EAAK,EAAE;IACxD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACvD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC,CAAC"}
@@ -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,10 @@
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 const randomFloat = (min, max) => Math.random() * (max - min) + min;
10
+ //# sourceMappingURL=randomFloat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomFloat.js","sourceRoot":"","sources":["../../src/Random/randomFloat.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,GAAW,EAAU,EAAE,CAC9D,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC"}
@@ -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,14 @@
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 const randomInt = (min, max) => {
10
+ const lo = Math.ceil(min);
11
+ const hi = Math.floor(max);
12
+ return Math.floor(Math.random() * (hi - lo + 1)) + lo;
13
+ };
14
+ //# sourceMappingURL=randomInt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomInt.js","sourceRoot":"","sources":["../../src/Random/randomInt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,GAAW,EAAU,EAAE;IAC5D,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AACxD,CAAC,CAAC"}
@@ -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,31 @@
1
+ const DIGITS = "0123456789abcdef";
2
+ const bytesToUuid = (bytes) => {
3
+ let result = "";
4
+ for (let index = 0; index < 16; index += 1) {
5
+ if (index === 4 || index === 6 || index === 8 || index === 10) {
6
+ result += "-";
7
+ }
8
+ const byte = bytes[index];
9
+ result += DIGITS[byte >>> 4] + DIGITS[byte & 0xf];
10
+ }
11
+ return result;
12
+ };
13
+ /**
14
+ * Generates a UUID v4 string. Uses `crypto.randomUUID` when available,
15
+ * otherwise falls back to `crypto.getRandomValues`.
16
+ *
17
+ * @returns {string} A UUID v4 in canonical 8-4-4-4-12 hex form
18
+ * @example
19
+ * randomUUID(); // e.g. "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed"
20
+ */
21
+ export const randomUUID = () => {
22
+ if (typeof globalThis.crypto?.randomUUID === "function") {
23
+ return globalThis.crypto.randomUUID();
24
+ }
25
+ const bytes = new Uint8Array(16);
26
+ globalThis.crypto.getRandomValues(bytes);
27
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
28
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
29
+ return bytesToUuid(bytes);
30
+ };
31
+ //# sourceMappingURL=randomUuid.js.map
@@ -0,0 +1 @@
1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;AAC5B,CAAC,CAAC"}
@@ -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,31 @@
1
+ import { xoshiro256 } from "../Math/xoshiro256";
2
+ const TEXT_ENCODER = new TextEncoder();
3
+ const hashStringToSeed = (input) => {
4
+ let hash = 2_166_136_261;
5
+ for (const byte of TEXT_ENCODER.encode(input)) {
6
+ hash ^= byte;
7
+ hash = Math.imul(hash, 16_777_619);
8
+ }
9
+ return hash >>> 0;
10
+ };
11
+ /**
12
+ * Returns a deterministic PRNG seeded from a number or string. Each call
13
+ * produces a float in `[0, 1)` from the same xoshiro256** stream.
14
+ *
15
+ * @param {number | string} seed - Seed value
16
+ * @returns {() => number} A function that returns sequential pseudo-random floats
17
+ * @example
18
+ * const rand = seededRandom("hello");
19
+ * rand(); // deterministic for the same seed
20
+ */
21
+ export const seededRandom = (seed) => {
22
+ const initial = typeof seed === "number" ? seed >>> 0 : hashStringToSeed(seed);
23
+ const state = [
24
+ initial || 1,
25
+ Math.imul(initial, 0x9e_37_79_b9) >>> 0 || 2,
26
+ Math.imul(initial, 0x85_eb_ca_6b) >>> 0 || 3,
27
+ Math.imul(initial, 0xc2_b2_ae_35) >>> 0 || 4,
28
+ ];
29
+ return () => xoshiro256(state);
30
+ };
31
+ //# sourceMappingURL=seededRandom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seededRandom.js","sourceRoot":"","sources":["../../src/Random/seededRandom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC;AAEvC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAU,EAAE;IACjD,IAAI,IAAI,GAAG,aAAa,CAAC;IACzB,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,IAAI,IAAI,IAAI,CAAC;QACb,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,CAAC;AACpB,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAqB,EAAkB,EAAE;IACpE,MAAM,OAAO,GACX,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACjE,MAAM,KAAK,GAAqC;QAC9C,OAAO,IAAI,CAAC;QACZ,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC;KAC7C,CAAC;IACF,OAAO,GAAW,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC,CAAC"}
@@ -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,34 @@
1
+ /**
2
+ * Returns a random element using cumulative weights and binary search.
3
+ * Items with non-positive weights are skipped from the pool.
4
+ *
5
+ * @template T - Element type
6
+ * @param {readonly WeightedItem<T>[]} items - Items with non-negative weights
7
+ * @returns {T} A randomly selected element
8
+ * @example
9
+ * weightedChoice([{ value: "a", weight: 1 }, { value: "b", weight: 4 }]);
10
+ */
11
+ export const weightedChoice = (items) => {
12
+ const cumulative = [];
13
+ let total = 0;
14
+ for (const item of items) {
15
+ if (item.weight > 0) {
16
+ total += item.weight;
17
+ }
18
+ cumulative.push(total);
19
+ }
20
+ const target = Math.random() * total;
21
+ let lo = 0;
22
+ let hi = cumulative.length - 1;
23
+ while (lo < hi) {
24
+ const mid = (lo + hi) >>> 1;
25
+ if (cumulative[mid] <= target) {
26
+ lo = mid + 1;
27
+ }
28
+ else {
29
+ hi = mid;
30
+ }
31
+ }
32
+ return items[lo].value;
33
+ };
34
+ //# sourceMappingURL=weightedChoice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weightedChoice.js","sourceRoot":"","sources":["../../src/Random/weightedChoice.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAI,KAAiC,EAAK,EAAE;IACxE,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC;QACvB,CAAC;QACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC;IACrC,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,IAAI,EAAE,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/B,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,EAAE,CAAC;YAC9B,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC;QACf,CAAC;aAAM,CAAC;YACN,EAAE,GAAG,GAAG,CAAC;QACX,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC;AACzB,CAAC,CAAC"}
@@ -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,18 @@
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 const capitalize = (string_) => {
13
+ for (const first of string_) {
14
+ return first.toUpperCase() + string_.slice(first.length);
15
+ }
16
+ return string_;
17
+ };
18
+ //# sourceMappingURL=capitalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capitalize.js","sourceRoot":"","sources":["../../src/String/capitalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAe,EAAU,EAAE;IACpD,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 @@
1
+ export declare const capitalizeWord: (word: string) => string;
@@ -0,0 +1,2 @@
1
+ export const capitalizeWord = (word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
2
+ //# sourceMappingURL=capitalizeWord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capitalizeWord.js","sourceRoot":"","sources":["../../src/String/capitalizeWord.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE,CACrD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC"}