es-toolkit 1.10.1 → 1.11.0-dev.263

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 (220) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/compat.d.ts +1 -0
  3. package/dist/array/chunk.mjs +1 -1
  4. package/dist/array/compact.mjs +1 -1
  5. package/dist/array/countBy.mjs +1 -1
  6. package/dist/array/difference.mjs +1 -1
  7. package/dist/array/differenceBy.mjs +1 -1
  8. package/dist/array/differenceWith.mjs +1 -1
  9. package/dist/array/drop.js +1 -0
  10. package/dist/array/drop.js.map +1 -1
  11. package/dist/array/drop.mjs +2 -2
  12. package/dist/array/dropRight.js +5 -1
  13. package/dist/array/dropRight.js.map +1 -1
  14. package/dist/array/dropRight.mjs +2 -2
  15. package/dist/array/dropRightWhile.js +6 -14
  16. package/dist/array/dropRightWhile.js.map +1 -1
  17. package/dist/array/dropRightWhile.mjs +2 -3
  18. package/dist/array/dropWhile.mjs +1 -1
  19. package/dist/array/fill.d.mts +10 -7
  20. package/dist/array/fill.d.ts +10 -7
  21. package/dist/array/fill.js +7 -6
  22. package/dist/array/fill.js.map +1 -1
  23. package/dist/array/fill.mjs +2 -2
  24. package/dist/array/flatMap.d.mts +23 -0
  25. package/dist/array/flatMap.d.ts +23 -0
  26. package/dist/array/flatMap.js +52 -0
  27. package/dist/array/flatMap.js.map +1 -0
  28. package/dist/array/flatMap.mjs +9 -0
  29. package/dist/array/flatten.mjs +1 -1
  30. package/dist/array/flattenDeep.mjs +1 -1
  31. package/dist/array/forEachRight.mjs +1 -1
  32. package/dist/array/groupBy.mjs +1 -1
  33. package/dist/array/head.mjs +1 -1
  34. package/dist/array/index.d.mts +1 -0
  35. package/dist/array/index.d.ts +1 -0
  36. package/dist/array/index.js +30 -14
  37. package/dist/array/index.js.map +1 -1
  38. package/dist/array/index.mjs +41 -37
  39. package/dist/array/initial.mjs +1 -1
  40. package/dist/array/intersection.mjs +1 -1
  41. package/dist/array/intersectionBy.mjs +1 -1
  42. package/dist/array/intersectionWith.mjs +1 -1
  43. package/dist/array/keyBy.mjs +1 -1
  44. package/dist/array/last.mjs +1 -1
  45. package/dist/array/maxBy.mjs +1 -1
  46. package/dist/array/minBy.mjs +1 -1
  47. package/dist/array/orderBy.mjs +1 -1
  48. package/dist/array/partition.mjs +1 -1
  49. package/dist/array/sample.mjs +1 -1
  50. package/dist/array/sampleSize.mjs +1 -1
  51. package/dist/array/shuffle.mjs +1 -1
  52. package/dist/array/tail.mjs +1 -1
  53. package/dist/array/take.mjs +1 -1
  54. package/dist/array/takeRight.mjs +1 -1
  55. package/dist/array/takeRightWhile.mjs +1 -1
  56. package/dist/array/takeWhile.mjs +1 -1
  57. package/dist/array/toFilled.mjs +1 -1
  58. package/dist/array/union.mjs +1 -1
  59. package/dist/array/unionBy.mjs +1 -1
  60. package/dist/array/unionWith.mjs +1 -1
  61. package/dist/array/uniq.mjs +1 -1
  62. package/dist/array/uniqBy.d.mts +1 -1
  63. package/dist/array/uniqBy.d.ts +1 -1
  64. package/dist/array/uniqBy.js.map +1 -1
  65. package/dist/array/uniqBy.mjs +2 -2
  66. package/dist/array/uniqWith.mjs +1 -1
  67. package/dist/array/unzip.mjs +1 -1
  68. package/dist/array/unzipWith.mjs +1 -1
  69. package/dist/array/without.mjs +1 -1
  70. package/dist/array/xor.mjs +1 -1
  71. package/dist/array/xorBy.mjs +1 -1
  72. package/dist/array/xorWith.mjs +1 -1
  73. package/dist/array/zip.mjs +1 -1
  74. package/dist/array/zipObject.mjs +1 -1
  75. package/dist/array/zipWith.mjs +1 -1
  76. package/dist/{chunk-S3CORED5.mjs → chunk-3EZAFZG3.mjs} +2 -1
  77. package/dist/{chunk-S3CORED5.mjs.map → chunk-3EZAFZG3.mjs.map} +1 -1
  78. package/dist/{chunk-2MM5EJJX.mjs → chunk-424M7IR7.mjs} +23 -2
  79. package/dist/chunk-4OIZM4HS.mjs +1 -0
  80. package/dist/{chunk-GDC64SYJ.mjs → chunk-5ASRKEB4.mjs} +1 -1
  81. package/dist/{chunk-GDC64SYJ.mjs.map → chunk-5ASRKEB4.mjs.map} +1 -1
  82. package/dist/{chunk-OXAZEEGP.mjs → chunk-B4COTK4K.mjs} +1 -1
  83. package/dist/{chunk-OXAZEEGP.mjs.map → chunk-B4COTK4K.mjs.map} +1 -1
  84. package/dist/chunk-DDH7K4QM.mjs +1 -0
  85. package/dist/chunk-F47GLYUU.mjs +1 -0
  86. package/dist/chunk-J3GE7DEU.mjs +22 -0
  87. package/dist/chunk-J3GE7DEU.mjs.map +1 -0
  88. package/dist/chunk-KIOYQRMQ.mjs +12 -0
  89. package/dist/chunk-KIOYQRMQ.mjs.map +1 -0
  90. package/dist/chunk-M7SBBYV2.mjs +14 -0
  91. package/dist/chunk-M7SBBYV2.mjs.map +1 -0
  92. package/dist/{chunk-IZAD2S7R.mjs → chunk-MY4G7R3I.mjs} +2 -2
  93. package/dist/{chunk-74WWMNZS.mjs → chunk-OLX53VEF.mjs} +4 -2
  94. package/dist/{chunk-74WWMNZS.mjs.map → chunk-OLX53VEF.mjs.map} +1 -1
  95. package/dist/chunk-OXZCMC5I.mjs +13 -0
  96. package/dist/{chunk-JEKUA56R.mjs.map → chunk-OXZCMC5I.mjs.map} +1 -1
  97. package/dist/chunk-QXTNZR7B.mjs +25 -0
  98. package/dist/chunk-QXTNZR7B.mjs.map +1 -0
  99. package/dist/{chunk-QZITBKWX.mjs → chunk-U7V3G7CR.mjs} +2 -2
  100. package/dist/chunk-UY76KTPE.mjs +13 -0
  101. package/dist/chunk-UY76KTPE.mjs.map +1 -0
  102. package/dist/chunk-XT74R35S.mjs +1 -0
  103. package/dist/chunk-XT74R35S.mjs.map +1 -0
  104. package/dist/chunk-XWPCDIFC.mjs +18 -0
  105. package/dist/chunk-XWPCDIFC.mjs.map +1 -0
  106. package/dist/chunk-YFN6KOC4.mjs +15 -0
  107. package/dist/chunk-YFN6KOC4.mjs.map +1 -0
  108. package/dist/compat/index.d.mts +392 -1
  109. package/dist/compat/index.d.ts +392 -1
  110. package/dist/compat/index.js +276 -21
  111. package/dist/compat/index.js.map +1 -1
  112. package/dist/compat/index.mjs +268 -87
  113. package/dist/compat/index.mjs.map +1 -1
  114. package/dist/error/AbortError.mjs +1 -1
  115. package/dist/error/TimeoutError.d.mts +9 -0
  116. package/dist/error/TimeoutError.d.ts +9 -0
  117. package/dist/error/TimeoutError.js +36 -0
  118. package/dist/error/TimeoutError.js.map +1 -0
  119. package/dist/error/TimeoutError.mjs +8 -0
  120. package/dist/error/TimeoutError.mjs.map +1 -0
  121. package/dist/error/index.d.mts +1 -0
  122. package/dist/error/index.d.ts +1 -0
  123. package/dist/error/index.js +12 -2
  124. package/dist/error/index.js.map +1 -1
  125. package/dist/error/index.mjs +7 -3
  126. package/dist/function/debounce.mjs +1 -1
  127. package/dist/function/index.mjs +7 -7
  128. package/dist/function/negate.mjs +1 -1
  129. package/dist/function/noop.mjs +1 -1
  130. package/dist/function/once.mjs +1 -1
  131. package/dist/function/throttle.mjs +1 -1
  132. package/dist/index.d.mts +4 -0
  133. package/dist/index.d.ts +4 -0
  134. package/dist/index.js +99 -15
  135. package/dist/index.js.map +1 -1
  136. package/dist/index.mjs +104 -87
  137. package/dist/math/clamp.mjs +1 -1
  138. package/dist/math/inRange.mjs +1 -1
  139. package/dist/math/index.js.map +1 -1
  140. package/dist/math/index.mjs +12 -12
  141. package/dist/math/mean.d.mts +1 -1
  142. package/dist/math/mean.d.ts +1 -1
  143. package/dist/math/mean.js.map +1 -1
  144. package/dist/math/mean.mjs +2 -2
  145. package/dist/math/meanBy.js.map +1 -1
  146. package/dist/math/meanBy.mjs +3 -3
  147. package/dist/math/random.mjs +1 -1
  148. package/dist/math/randomInt.mjs +1 -1
  149. package/dist/math/range.mjs +1 -1
  150. package/dist/math/round.mjs +1 -1
  151. package/dist/math/sum.mjs +1 -1
  152. package/dist/math/sumBy.mjs +1 -1
  153. package/dist/object/clone.mjs +1 -1
  154. package/dist/object/index.js +3 -1
  155. package/dist/object/index.js.map +1 -1
  156. package/dist/object/index.mjs +6 -6
  157. package/dist/object/invert.js +3 -1
  158. package/dist/object/invert.js.map +1 -1
  159. package/dist/object/invert.mjs +2 -2
  160. package/dist/object/omit.mjs +2 -2
  161. package/dist/object/omitBy.mjs +1 -1
  162. package/dist/object/pick.mjs +1 -1
  163. package/dist/object/pickBy.mjs +1 -1
  164. package/dist/predicate/index.mjs +1 -1
  165. package/dist/predicate/isEqual.mjs +1 -1
  166. package/dist/predicate/isNil.mjs +1 -1
  167. package/dist/predicate/isNotNil.mjs +1 -1
  168. package/dist/predicate/isNull.mjs +1 -1
  169. package/dist/predicate/isUndefined.mjs +1 -1
  170. package/dist/promise/delay.mjs +1 -1
  171. package/dist/promise/index.d.mts +1 -0
  172. package/dist/promise/index.d.ts +1 -0
  173. package/dist/promise/index.js +47 -2
  174. package/dist/promise/index.js.map +1 -1
  175. package/dist/promise/index.mjs +9 -3
  176. package/dist/promise/timeout.d.mts +10 -0
  177. package/dist/promise/timeout.d.ts +10 -0
  178. package/dist/promise/timeout.js +92 -0
  179. package/dist/promise/timeout.js.map +1 -0
  180. package/dist/promise/timeout.mjs +11 -0
  181. package/dist/promise/timeout.mjs.map +1 -0
  182. package/dist/promise/withTimeout.d.mts +22 -0
  183. package/dist/promise/withTimeout.d.ts +22 -0
  184. package/dist/promise/withTimeout.js +99 -0
  185. package/dist/promise/withTimeout.js.map +1 -0
  186. package/dist/promise/withTimeout.mjs +12 -0
  187. package/dist/promise/withTimeout.mjs.map +1 -0
  188. package/dist/string/camelCase.mjs +1 -1
  189. package/dist/string/capitalize.mjs +1 -1
  190. package/dist/string/index.d.mts +1 -0
  191. package/dist/string/index.d.ts +1 -0
  192. package/dist/string/index.js +21 -2
  193. package/dist/string/index.js.map +1 -1
  194. package/dist/string/index.mjs +13 -9
  195. package/dist/string/kebabCase.mjs +1 -1
  196. package/dist/string/lowerCase.mjs +1 -1
  197. package/dist/string/snakeCase.mjs +1 -1
  198. package/dist/string/startCase.d.mts +16 -0
  199. package/dist/string/startCase.d.ts +16 -0
  200. package/dist/string/startCase.js +54 -0
  201. package/dist/string/startCase.js.map +1 -0
  202. package/dist/string/startCase.mjs +9 -0
  203. package/dist/string/startCase.mjs.map +1 -0
  204. package/package.json +3 -5
  205. package/dist/chunk-2MRZANXZ.mjs +0 -1
  206. package/dist/chunk-ARZ5BDR6.mjs +0 -1
  207. package/dist/chunk-C4WE4GLC.mjs +0 -14
  208. package/dist/chunk-C4WE4GLC.mjs.map +0 -1
  209. package/dist/chunk-FZEZH22H.mjs +0 -1
  210. package/dist/chunk-JE6JKZU3.mjs +0 -15
  211. package/dist/chunk-JE6JKZU3.mjs.map +0 -1
  212. package/dist/chunk-JEKUA56R.mjs +0 -9
  213. package/dist/chunk-QKYYOLJ6.mjs +0 -1
  214. /package/dist/{chunk-2MM5EJJX.mjs.map → array/flatMap.mjs.map} +0 -0
  215. /package/dist/{chunk-2MRZANXZ.mjs.map → chunk-424M7IR7.mjs.map} +0 -0
  216. /package/dist/{chunk-ARZ5BDR6.mjs.map → chunk-4OIZM4HS.mjs.map} +0 -0
  217. /package/dist/{chunk-FZEZH22H.mjs.map → chunk-DDH7K4QM.mjs.map} +0 -0
  218. /package/dist/{chunk-QKYYOLJ6.mjs.map → chunk-F47GLYUU.mjs.map} +0 -0
  219. /package/dist/{chunk-IZAD2S7R.mjs.map → chunk-MY4G7R3I.mjs.map} +0 -0
  220. /package/dist/{chunk-QZITBKWX.mjs.map → chunk-U7V3G7CR.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  orderBy
3
3
  } from "../chunk-7B7W36UP.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  orderBy
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  partition
3
3
  } from "../chunk-DN3NOZ3H.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  partition
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  sample
3
3
  } from "../chunk-2KNLZB7V.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  sample
7
7
  };
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-EHSKB6DF.mjs";
4
4
  import "../chunk-GIWAOOFY.mjs";
5
5
  import "../chunk-SYWMYQYJ.mjs";
6
- import "../chunk-2MM5EJJX.mjs";
6
+ import "../chunk-424M7IR7.mjs";
7
7
  export {
8
8
  sampleSize
9
9
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  shuffle
3
3
  } from "../chunk-G7UQ5PUR.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  shuffle
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  tail
3
3
  } from "../chunk-OF6NM4G7.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  tail
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  take
3
3
  } from "../chunk-ME352XO7.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  take
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  takeRight
3
3
  } from "../chunk-IQLKIDXF.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  takeRight
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  takeRightWhile
3
3
  } from "../chunk-NTLX2MPV.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  takeRightWhile
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  takeWhile
3
3
  } from "../chunk-2IXFGSUA.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  takeWhile
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  toFilled
3
3
  } from "../chunk-OP4OAKQJ.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  toFilled
7
7
  };
@@ -2,7 +2,7 @@ import {
2
2
  union
3
3
  } from "../chunk-R6QA7PLZ.mjs";
4
4
  import "../chunk-DVK2N4KC.mjs";
5
- import "../chunk-2MM5EJJX.mjs";
5
+ import "../chunk-424M7IR7.mjs";
6
6
  export {
7
7
  union
8
8
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unionBy
3
3
  } from "../chunk-NFS7RWWE.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  unionBy
7
7
  };
@@ -2,7 +2,7 @@ import {
2
2
  unionWith
3
3
  } from "../chunk-2ZCITDMK.mjs";
4
4
  import "../chunk-237HGSZS.mjs";
5
- import "../chunk-2MM5EJJX.mjs";
5
+ import "../chunk-424M7IR7.mjs";
6
6
  export {
7
7
  unionWith
8
8
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  uniq
3
3
  } from "../chunk-DVK2N4KC.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  uniq
7
7
  };
@@ -11,7 +11,7 @@
11
11
  * @example
12
12
  * ```ts
13
13
  * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);
14
- * // [1.2, 2.1, 3.3, 5.7, 7.19]
14
+ * // [1.2, 2.1, 3.2, 5.7, 7.19]
15
15
  * ```
16
16
  */
17
17
  declare function uniqBy<T, U>(arr: readonly T[], mapper: (item: T) => U): T[];
@@ -11,7 +11,7 @@
11
11
  * @example
12
12
  * ```ts
13
13
  * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);
14
- * // [1.2, 2.1, 3.3, 5.7, 7.19]
14
+ * // [1.2, 2.1, 3.2, 5.7, 7.19]
15
15
  * ```
16
16
  */
17
17
  declare function uniqBy<T, U>(arr: readonly T[], mapper: (item: T) => U): T[];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/array/uniqBy.ts"],"sourcesContent":["/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the mapper function.\n *\n * @template T - The type of elements in the array.\n * @template U - The type of mapped elements.\n * @param {T[]} arr - The array to process.\n * @param {(item: T) => U} mapper - The function used to convert the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the mapper function.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.3, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: readonly T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of arr) {\n const key = mapper(item);\n\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return Array.from(map.values());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,SAAS,OAAa,KAAmB,QAA6B;AAC3E,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,KAAK;AACtB,UAAM,MAAM,OAAO,IAAI;AAEvB,QAAI,CAAC,IAAI,IAAI,GAAG,GAAG;AACjB,UAAI,IAAI,KAAK,IAAI;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,MAAM,KAAK,IAAI,OAAO,CAAC;AAChC;","names":[]}
1
+ {"version":3,"sources":["../../src/array/uniqBy.ts"],"sourcesContent":["/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the mapper function.\n *\n * @template T - The type of elements in the array.\n * @template U - The type of mapped elements.\n * @param {T[]} arr - The array to process.\n * @param {(item: T) => U} mapper - The function used to convert the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the mapper function.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.2, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: readonly T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of arr) {\n const key = mapper(item);\n\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return Array.from(map.values());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,SAAS,OAAa,KAAmB,QAA6B;AAC3E,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,KAAK;AACtB,UAAM,MAAM,OAAO,IAAI;AAEvB,QAAI,CAAC,IAAI,IAAI,GAAG,GAAG;AACjB,UAAI,IAAI,KAAK,IAAI;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,MAAM,KAAK,IAAI,OAAO,CAAC;AAChC;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  uniqBy
3
- } from "../chunk-OXAZEEGP.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
3
+ } from "../chunk-B4COTK4K.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  uniqBy
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  uniqWith
3
3
  } from "../chunk-237HGSZS.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  uniqWith
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unzip
3
3
  } from "../chunk-UYZKMBDO.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  unzip
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unzipWith
3
3
  } from "../chunk-IFNXROZR.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  unzipWith
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  without
3
3
  } from "../chunk-PYEYV7BY.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  without
7
7
  };
@@ -5,7 +5,7 @@ import "../chunk-R6QA7PLZ.mjs";
5
5
  import "../chunk-DVK2N4KC.mjs";
6
6
  import "../chunk-FVVSE2F2.mjs";
7
7
  import "../chunk-JPUKH67K.mjs";
8
- import "../chunk-2MM5EJJX.mjs";
8
+ import "../chunk-424M7IR7.mjs";
9
9
  export {
10
10
  xor
11
11
  };
@@ -4,7 +4,7 @@ import {
4
4
  import "../chunk-NFS7RWWE.mjs";
5
5
  import "../chunk-O6UXZR3U.mjs";
6
6
  import "../chunk-LVWX5B43.mjs";
7
- import "../chunk-2MM5EJJX.mjs";
7
+ import "../chunk-424M7IR7.mjs";
8
8
  export {
9
9
  xorBy
10
10
  };
@@ -5,7 +5,7 @@ import "../chunk-2ZCITDMK.mjs";
5
5
  import "../chunk-237HGSZS.mjs";
6
6
  import "../chunk-XI7KRD2C.mjs";
7
7
  import "../chunk-6NVQAHXP.mjs";
8
- import "../chunk-2MM5EJJX.mjs";
8
+ import "../chunk-424M7IR7.mjs";
9
9
  export {
10
10
  xorWith
11
11
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  zip
3
3
  } from "../chunk-IDCUZVJL.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  zip
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  zipObject
3
3
  } from "../chunk-6GWEY5EL.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  zipObject
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  zipWith
3
3
  } from "../chunk-4KYXHZ4R.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  zipWith
7
7
  };
@@ -1,9 +1,10 @@
1
1
  // src/array/drop.ts
2
2
  function drop(arr, itemsCount) {
3
+ itemsCount = Math.max(itemsCount, 0);
3
4
  return arr.slice(itemsCount);
4
5
  }
5
6
 
6
7
  export {
7
8
  drop
8
9
  };
9
- //# sourceMappingURL=chunk-S3CORED5.mjs.map
10
+ //# sourceMappingURL=chunk-3EZAFZG3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/array/drop.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the beginning of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the start.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the beginning of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the start.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = drop(array, 2);\n * // result will be [3, 4, 5] since the first two elements are dropped.\n */\nexport function drop<T>(arr: readonly T[], itemsCount: number): T[] {\n return arr.slice(itemsCount);\n}\n"],"mappings":";AAgBO,SAAS,KAAQ,KAAmB,YAAyB;AAClE,SAAO,IAAI,MAAM,UAAU;AAC7B;","names":[]}
1
+ {"version":3,"sources":["../src/array/drop.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the beginning of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the start.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the beginning of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the start.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = drop(array, 2);\n * // result will be [3, 4, 5] since the first two elements are dropped.\n */\nexport function drop<T>(arr: readonly T[], itemsCount: number): T[] {\n itemsCount = Math.max(itemsCount, 0);\n\n return arr.slice(itemsCount);\n}\n"],"mappings":";AAgBO,SAAS,KAAQ,KAAmB,YAAyB;AAClE,eAAa,KAAK,IAAI,YAAY,CAAC;AAEnC,SAAO,IAAI,MAAM,UAAU;AAC7B;","names":[]}
@@ -14,8 +14,29 @@ var __spreadValues = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
+ var __async = (__this, __arguments, generator) => {
18
+ return new Promise((resolve, reject) => {
19
+ var fulfilled = (value) => {
20
+ try {
21
+ step(generator.next(value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ };
26
+ var rejected = (value) => {
27
+ try {
28
+ step(generator.throw(value));
29
+ } catch (e) {
30
+ reject(e);
31
+ }
32
+ };
33
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
34
+ step((generator = generator.apply(__this, __arguments)).next());
35
+ });
36
+ };
17
37
 
18
38
  export {
19
- __spreadValues
39
+ __spreadValues,
40
+ __async
20
41
  };
21
- //# sourceMappingURL=chunk-2MM5EJJX.mjs.map
42
+ //# sourceMappingURL=chunk-424M7IR7.mjs.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-4OIZM4HS.mjs.map
@@ -10,4 +10,4 @@ function mean(nums) {
10
10
  export {
11
11
  mean
12
12
  };
13
- //# sourceMappingURL=chunk-GDC64SYJ.mjs.map
13
+ //# sourceMappingURL=chunk-5ASRKEB4.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/math/mean.ts"],"sourcesContent":["import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = average(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n"],"mappings":";;;;;AAeO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;","names":[]}
1
+ {"version":3,"sources":["../src/math/mean.ts"],"sourcesContent":["import { sum } from './sum.ts';\n\n/**\n * Calculates the average of an array of numbers.\n *\n * If the array is empty, this function returns `NaN`.\n *\n * @param {number[]} nums - An array of numbers to calculate the average.\n * @returns {number} The average of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = mean(numbers);\n * // result will be 3\n */\nexport function mean(nums: readonly number[]): number {\n return sum(nums) / nums.length;\n}\n"],"mappings":";;;;;AAeO,SAAS,KAAK,MAAiC;AACpD,SAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;","names":[]}
@@ -13,4 +13,4 @@ function uniqBy(arr, mapper) {
13
13
  export {
14
14
  uniqBy
15
15
  };
16
- //# sourceMappingURL=chunk-OXAZEEGP.mjs.map
16
+ //# sourceMappingURL=chunk-B4COTK4K.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/array/uniqBy.ts"],"sourcesContent":["/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the mapper function.\n *\n * @template T - The type of elements in the array.\n * @template U - The type of mapped elements.\n * @param {T[]} arr - The array to process.\n * @param {(item: T) => U} mapper - The function used to convert the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the mapper function.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.3, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: readonly T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of arr) {\n const key = mapper(item);\n\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return Array.from(map.values());\n}\n"],"mappings":";AAgBO,SAAS,OAAa,KAAmB,QAA6B;AAC3E,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,KAAK;AACtB,UAAM,MAAM,OAAO,IAAI;AAEvB,QAAI,CAAC,IAAI,IAAI,GAAG,GAAG;AACjB,UAAI,IAAI,KAAK,IAAI;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,MAAM,KAAK,IAAI,OAAO,CAAC;AAChC;","names":[]}
1
+ {"version":3,"sources":["../src/array/uniqBy.ts"],"sourcesContent":["/**\n * Returns a new array containing only the unique elements from the original array,\n * based on the values returned by the mapper function.\n *\n * @template T - The type of elements in the array.\n * @template U - The type of mapped elements.\n * @param {T[]} arr - The array to process.\n * @param {(item: T) => U} mapper - The function used to convert the array elements.\n * @returns {T[]} A new array containing only the unique elements from the original array, based on the values returned by the mapper function.\n *\n * @example\n * ```ts\n * uniqBy([1.2, 1.5, 2.1, 3.2, 5.7, 5.3, 7.19], Math.floor);\n * // [1.2, 2.1, 3.2, 5.7, 7.19]\n * ```\n */\nexport function uniqBy<T, U>(arr: readonly T[], mapper: (item: T) => U): T[] {\n const map = new Map<U, T>();\n\n for (const item of arr) {\n const key = mapper(item);\n\n if (!map.has(key)) {\n map.set(key, item);\n }\n }\n\n return Array.from(map.values());\n}\n"],"mappings":";AAgBO,SAAS,OAAa,KAAmB,QAA6B;AAC3E,QAAM,MAAM,oBAAI,IAAU;AAE1B,aAAW,QAAQ,KAAK;AACtB,UAAM,MAAM,OAAO,IAAI;AAEvB,QAAI,CAAC,IAAI,IAAI,GAAG,GAAG;AACjB,UAAI,IAAI,KAAK,IAAI;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,MAAM,KAAK,IAAI,OAAO,CAAC;AAChC;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-DDH7K4QM.mjs.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-F47GLYUU.mjs.map
@@ -0,0 +1,22 @@
1
+ import {
2
+ delay
3
+ } from "./chunk-O64NE2P4.mjs";
4
+ import {
5
+ TimeoutError
6
+ } from "./chunk-KIOYQRMQ.mjs";
7
+ import {
8
+ __async
9
+ } from "./chunk-424M7IR7.mjs";
10
+
11
+ // src/promise/timeout.ts
12
+ function timeout(ms) {
13
+ return __async(this, null, function* () {
14
+ yield delay(ms);
15
+ throw new TimeoutError();
16
+ });
17
+ }
18
+
19
+ export {
20
+ timeout
21
+ };
22
+ //# sourceMappingURL=chunk-J3GE7DEU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/promise/timeout.ts"],"sourcesContent":["import { delay } from './delay.ts';\nimport { TimeoutError } from '../error/TimeoutError.ts';\n\n/**\n * Returns a promise that rejects with a `TimeoutError` after a specified delay.\n *\n * @param {number} ms - The delay duration in milliseconds.\n * @returns {Promise<void>} A promise that rejects with a `TimeoutError` after the specified delay.\n * @throws {TimeoutError} Throws a `TimeoutError` after the specified delay.\n */\nexport async function timeout(ms: number): Promise<never> {\n await delay(ms);\n throw new TimeoutError();\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAsB,QAAQ,IAA4B;AAAA;AACxD,UAAM,MAAM,EAAE;AACd,UAAM,IAAI,aAAa;AAAA,EACzB;AAAA;","names":[]}
@@ -0,0 +1,12 @@
1
+ // src/error/TimeoutError.ts
2
+ var TimeoutError = class extends Error {
3
+ constructor(message = "The operation was timed out") {
4
+ super(message);
5
+ this.name = "TimeoutError";
6
+ }
7
+ };
8
+
9
+ export {
10
+ TimeoutError
11
+ };
12
+ //# sourceMappingURL=chunk-KIOYQRMQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/error/TimeoutError.ts"],"sourcesContent":["/**\n * An error class representing an timeout operation.\n * @augments Error\n */\nexport class TimeoutError extends Error {\n constructor(message = 'The operation was timed out') {\n super(message);\n this.name = 'TimeoutError';\n }\n}\n"],"mappings":";AAIO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,UAAU,+BAA+B;AACnD,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;","names":[]}
@@ -0,0 +1,14 @@
1
+ // src/array/dropRightWhile.ts
2
+ function dropRightWhile(arr, canContinueDropping) {
3
+ for (let i = arr.length - 1; i >= 0; i--) {
4
+ if (!canContinueDropping(arr[i])) {
5
+ return arr.slice(0, i + 1);
6
+ }
7
+ }
8
+ return [];
9
+ }
10
+
11
+ export {
12
+ dropRightWhile
13
+ };
14
+ //# sourceMappingURL=chunk-M7SBBYV2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/dropRightWhile.ts"],"sourcesContent":["/**\n * Removes elements from the end of an array until the predicate returns false.\n *\n * This function iterates over an array from the end and drops elements until the provided\n * predicate function returns false. It then returns a new array with the remaining elements.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {(item: T) => boolean} canContinueDropping - A predicate function that determines\n * whether to continue dropping elements. The function is called with each element from the end,\n * and dropping continues as long as it returns true.\n * @returns {T[]} A new array with the elements remaining after the predicate returns false.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRightWhile(array, x => x > 3);\n * // result will be [1, 2, 3] since elements greater than 3 are dropped from the end.\n */\nexport function dropRightWhile<T>(arr: readonly T[], canContinueDropping: (item: T) => boolean): T[] {\n for (let i = arr.length - 1; i >= 0; i--) {\n if (!canContinueDropping(arr[i])) {\n return arr.slice(0, i + 1);\n }\n }\n\n return [];\n}\n"],"mappings":";AAkBO,SAAS,eAAkB,KAAmB,qBAAgD;AACnG,WAAS,IAAI,IAAI,SAAS,GAAG,KAAK,GAAG,KAAK;AACxC,QAAI,CAAC,oBAAoB,IAAI,CAAC,CAAC,GAAG;AAChC,aAAO,IAAI,MAAM,GAAG,IAAI,CAAC;AAAA,IAC3B;AAAA,EACF;AAEA,SAAO,CAAC;AACV;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mean
3
- } from "./chunk-GDC64SYJ.mjs";
3
+ } from "./chunk-5ASRKEB4.mjs";
4
4
 
5
5
  // src/math/meanBy.ts
6
6
  function meanBy(items, getValue) {
@@ -11,4 +11,4 @@ function meanBy(items, getValue) {
11
11
  export {
12
12
  meanBy
13
13
  };
14
- //# sourceMappingURL=chunk-IZAD2S7R.mjs.map
14
+ //# sourceMappingURL=chunk-MY4G7R3I.mjs.map
@@ -1,7 +1,9 @@
1
1
  // src/object/invert.ts
2
2
  function invert(obj) {
3
3
  const result = {};
4
- for (const key in obj) {
4
+ const keys = Object.keys(obj);
5
+ for (let i = 0; i < keys.length; i++) {
6
+ const key = keys[i];
5
7
  const value = obj[key];
6
8
  result[value] = key;
7
9
  }
@@ -11,4 +13,4 @@ function invert(obj) {
11
13
  export {
12
14
  invert
13
15
  };
14
- //# sourceMappingURL=chunk-74WWMNZS.mjs.map
16
+ //# sourceMappingURL=chunk-OLX53VEF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/object/invert.ts"],"sourcesContent":["/**\n * Inverts the keys and values of an object. The keys of the input object become the values of the output object and vice versa.\n *\n * This function takes an object and creates a new object by inverting its keys and values. If the input object has duplicate values,\n * the key of the last occurrence will be used as the value for the new key in the output object. It effectively creates a reverse mapping\n * of the input object's key-value pairs.\n *\n * @template K - Type of the keys in the input object (string, number, symbol)\n * @template V - Type of the values in the input object (string, number, symbol)\n * @param {Record<K, V>} obj - The input object whose keys and values are to be inverted\n * @returns {{ [key in V]: K }} - A new object with keys and values inverted\n *\n * @example\n * invert({ a: 1, b: 2, c: 3 }); // { 1: 'a', 2: 'b', 3: 'c' }\n * invert({ 1: 'a', 2: 'b', 3: 'c' }); // { a: '1', b: '2', c: '3' }\n * invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' }\n * invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' }\n */\nexport function invert<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): { [key in V]: K } {\n const result = {} as { [key in V]: K };\n\n for (const key in obj) {\n const value = obj[key as K] as V;\n result[value] = key;\n }\n\n return result;\n}\n"],"mappings":";AAkBO,SAAS,OAAqD,KAAsC;AACzG,QAAM,SAAS,CAAC;AAEhB,aAAW,OAAO,KAAK;AACrB,UAAM,QAAQ,IAAI,GAAQ;AAC1B,WAAO,KAAK,IAAI;AAAA,EAClB;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/object/invert.ts"],"sourcesContent":["/**\n * Inverts the keys and values of an object. The keys of the input object become the values of the output object and vice versa.\n *\n * This function takes an object and creates a new object by inverting its keys and values. If the input object has duplicate values,\n * the key of the last occurrence will be used as the value for the new key in the output object. It effectively creates a reverse mapping\n * of the input object's key-value pairs.\n *\n * @template K - Type of the keys in the input object (string, number, symbol)\n * @template V - Type of the values in the input object (string, number, symbol)\n * @param {Record<K, V>} obj - The input object whose keys and values are to be inverted\n * @returns {{ [key in V]: K }} - A new object with keys and values inverted\n *\n * @example\n * invert({ a: 1, b: 2, c: 3 }); // { 1: 'a', 2: 'b', 3: 'c' }\n * invert({ 1: 'a', 2: 'b', 3: 'c' }); // { a: '1', b: '2', c: '3' }\n * invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' }\n * invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' }\n */\nexport function invert<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): { [key in V]: K } {\n const result = {} as { [key in V]: K };\n\n const keys = Object.keys(obj) as K[];\n \n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = obj[key];\n result[value] = key;\n }\n\n return result;\n}\n"],"mappings":";AAkBO,SAAS,OAAqD,KAAsC;AACzG,QAAM,SAAS,CAAC;AAEhB,QAAM,OAAO,OAAO,KAAK,GAAG;AAE5B,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,MAAM,KAAK,CAAC;AAClB,UAAM,QAAQ,IAAI,GAAG;AACrB,WAAO,KAAK,IAAI;AAAA,EAClB;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,13 @@
1
+ // src/array/dropRight.ts
2
+ function dropRight(arr, itemsCount) {
3
+ itemsCount = Math.min(-itemsCount, 0);
4
+ if (itemsCount === 0) {
5
+ return arr.slice();
6
+ }
7
+ return arr.slice(0, itemsCount);
8
+ }
9
+
10
+ export {
11
+ dropRight
12
+ };
13
+ //# sourceMappingURL=chunk-OXZCMC5I.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/array/dropRight.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the end of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the end.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the end of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the end.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRight(array, 2);\n * // result will be [1, 2, 3] since the last two elements are dropped.\n */\nexport function dropRight<T>(arr: readonly T[], itemsCount: number): T[] {\n return arr.slice(0, -itemsCount);\n}\n"],"mappings":";AAgBO,SAAS,UAAa,KAAmB,YAAyB;AACvE,SAAO,IAAI,MAAM,GAAG,CAAC,UAAU;AACjC;","names":[]}
1
+ {"version":3,"sources":["../src/array/dropRight.ts"],"sourcesContent":["/**\n * Removes a specified number of elements from the end of an array and returns the rest.\n *\n * This function takes an array and a number, and returns a new array with the specified number\n * of elements removed from the end.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array from which to drop elements.\n * @param {number} itemsCount - The number of elements to drop from the end of the array.\n * @returns {T[]} A new array with the specified number of elements removed from the end.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * const result = dropRight(array, 2);\n * // result will be [1, 2, 3] since the last two elements are dropped.\n */\nexport function dropRight<T>(arr: readonly T[], itemsCount: number): T[] {\n itemsCount = Math.min(-itemsCount, 0);\n\n if (itemsCount === 0) {\n return arr.slice();\n }\n\n return arr.slice(0, itemsCount);\n}\n"],"mappings":";AAgBO,SAAS,UAAa,KAAmB,YAAyB;AACvE,eAAa,KAAK,IAAI,CAAC,YAAY,CAAC;AAEpC,MAAI,eAAe,GAAG;AACpB,WAAO,IAAI,MAAM;AAAA,EACnB;AAEA,SAAO,IAAI,MAAM,GAAG,UAAU;AAChC;","names":[]}
@@ -0,0 +1,25 @@
1
+ import {
2
+ getWords
3
+ } from "./chunk-WVQ7YVRK.mjs";
4
+
5
+ // src/string/startCase.ts
6
+ function startCase(str) {
7
+ const words = getWords(str.trim());
8
+ let result = "";
9
+ for (const word of words) {
10
+ if (result) {
11
+ result += " ";
12
+ }
13
+ if (word === word.toUpperCase()) {
14
+ result += word;
15
+ } else {
16
+ result += word[0].toUpperCase() + word.slice(1).toLowerCase();
17
+ }
18
+ }
19
+ return result;
20
+ }
21
+
22
+ export {
23
+ startCase
24
+ };
25
+ //# sourceMappingURL=chunk-QXTNZR7B.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/string/startCase.ts"],"sourcesContent":["import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts the first character of each word in a string to uppercase and the remaining characters to lowercase.\n *\n * Start case is the naming convention in which each word is written with an initial capital letter.\n * @param {string} str - The string to convert.\n * @returns {string} The converted string.\n *\n * @example\n * const result1 = startCase('hello world'); // result will be 'Hello World'\n * const result2 = startCase('HELLO WORLD'); // result will be 'Hello World'\n * const result3 = startCase('hello-world'); // result will be 'Hello World'\n * const result4 = startCase('hello_world'); // result will be 'Hello World'\n */\nexport function startCase(str: string): string {\n const words = getWords(str.trim());\n let result = '';\n for (const word of words) {\n if (result) {\n result += ' ';\n }\n if (word === word.toUpperCase()) {\n result += word;\n } else {\n result += word[0].toUpperCase() + word.slice(1).toLowerCase();\n }\n }\n return result;\n}\n"],"mappings":";;;;;AAeO,SAAS,UAAU,KAAqB;AAC7C,QAAM,QAAQ,SAAS,IAAI,KAAK,CAAC;AACjC,MAAI,SAAS;AACb,aAAW,QAAQ,OAAO;AACxB,QAAI,QAAQ;AACV,gBAAU;AAAA,IACZ;AACA,QAAI,SAAS,KAAK,YAAY,GAAG;AAC/B,gBAAU;AAAA,IACZ,OAAO;AACL,gBAAU,KAAK,CAAC,EAAE,YAAY,IAAI,KAAK,MAAM,CAAC,EAAE,YAAY;AAAA,IAC9D;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __spreadValues
3
- } from "./chunk-2MM5EJJX.mjs";
3
+ } from "./chunk-424M7IR7.mjs";
4
4
 
5
5
  // src/object/omit.ts
6
6
  function omit(obj, keys) {
@@ -14,4 +14,4 @@ function omit(obj, keys) {
14
14
  export {
15
15
  omit
16
16
  };
17
- //# sourceMappingURL=chunk-QZITBKWX.mjs.map
17
+ //# sourceMappingURL=chunk-U7V3G7CR.mjs.map
@@ -0,0 +1,13 @@
1
+ import {
2
+ flatten
3
+ } from "./chunk-33MSBDC6.mjs";
4
+
5
+ // src/array/flatMap.ts
6
+ function flatMap(arr, iteratee, depth = 1) {
7
+ return flatten(arr.map((item) => iteratee(item)), depth);
8
+ }
9
+
10
+ export {
11
+ flatMap
12
+ };
13
+ //# sourceMappingURL=chunk-UY76KTPE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/array/flatMap.ts"],"sourcesContent":["import { flatten } from './flatten.ts';\n\n/**\n * Maps each element in the array using the iteratee function and flattens the result up to the specified depth.\n *\n * @template T - The type of elements within the array.\n * @template U - The type of elements within the returned array from the iteratee function.\n * @template D - The depth to which the array should be flattened.\n * @param {T[]} arr - The array to flatten.\n * @param {(item: T) => U} iteratee - The function that produces the new array elements.\n * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1.\n * @returns {Array<FlatArray<U[], D>>} The new array with the mapped and flattened elements.\n *\n * @example\n * const arr = [1, 2, 3];\n *\n * flatMap(arr, (item: number) => [item, item]);\n * // [1, 1, 2, 2, 3, 3]\n *\n * flatMap(arr, (item: number) => [[item, item]], 2);\n * // [1, 1, 2, 2, 3, 3]\n */\nexport function flatMap<T, U, D extends number>(\n arr: readonly T[],\n iteratee: (item: T) => U,\n depth = 1 as D\n): Array<FlatArray<U[], D>> {\n return flatten(arr.map(item => iteratee(item)), depth);\n}\n"],"mappings":";;;;;AAsBO,SAAS,QACd,KACA,UACA,QAAQ,GACkB;AAC1B,SAAO,QAAQ,IAAI,IAAI,UAAQ,SAAS,IAAI,CAAC,GAAG,KAAK;AACvD;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-XT74R35S.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,18 @@
1
+ import {
2
+ timeout
3
+ } from "./chunk-J3GE7DEU.mjs";
4
+ import {
5
+ __async
6
+ } from "./chunk-424M7IR7.mjs";
7
+
8
+ // src/promise/withTimeout.ts
9
+ function withTimeout(run, ms) {
10
+ return __async(this, null, function* () {
11
+ return Promise.race([run(), timeout(ms)]);
12
+ });
13
+ }
14
+
15
+ export {
16
+ withTimeout
17
+ };
18
+ //# sourceMappingURL=chunk-XWPCDIFC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/promise/withTimeout.ts"],"sourcesContent":["import { timeout } from './timeout.ts';\n\n/**\n * Executes an async function and enforces a timeout. \n * \n * If the promise does not resolve within the specified time,\n * the timeout will trigger and the returned promise will be rejected.\n *\n *\n * @template T \n * @param {() => Promise<T>} run - A function that returns a promise to be executed.\n * @param {number} ms - The timeout duration in milliseconds.\n * @returns {Promise<T>} A promise that resolves with the result of the `run` function or rejects if the timeout is reached.\n *\n * @example\n * try {\n * await withTimeout(() => {}, 1000); // Timeout exception after 1 second\n * } catch (error) {\n * console.error(error); // Will log 'TimeoutError'\n * }\n */\nexport async function withTimeout<T>(run: () => Promise<T>, ms: number): Promise<T> {\n return Promise.race([run(), timeout(ms) as T]);\n}\n"],"mappings":";;;;;;;;AAqBA,SAAsB,YAAe,KAAuB,IAAwB;AAAA;AAClF,WAAO,QAAQ,KAAK,CAAC,IAAI,GAAG,QAAQ,EAAE,CAAM,CAAC;AAAA,EAC/C;AAAA;","names":[]}