es-toolkit 1.9.0 → 1.10.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 (245) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/README.md +1 -1
  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.mjs +1 -1
  10. package/dist/array/dropRight.mjs +1 -1
  11. package/dist/array/dropRightWhile.mjs +1 -1
  12. package/dist/array/dropWhile.mjs +1 -1
  13. package/dist/array/fill.mjs +1 -1
  14. package/dist/array/flatten.mjs +1 -1
  15. package/dist/array/flattenDeep.d.mts +25 -0
  16. package/dist/array/flattenDeep.d.ts +25 -0
  17. package/dist/array/flattenDeep.js +52 -0
  18. package/dist/array/flattenDeep.js.map +1 -0
  19. package/dist/array/flattenDeep.mjs +9 -0
  20. package/dist/array/forEachRight.mjs +1 -1
  21. package/dist/array/groupBy.mjs +1 -1
  22. package/dist/array/head.mjs +1 -1
  23. package/dist/array/index.d.mts +4 -0
  24. package/dist/array/index.d.ts +4 -0
  25. package/dist/array/index.js +38 -0
  26. package/dist/array/index.js.map +1 -1
  27. package/dist/array/index.mjs +58 -42
  28. package/dist/array/initial.d.mts +26 -0
  29. package/dist/array/initial.d.ts +26 -0
  30. package/dist/array/initial.js +36 -0
  31. package/dist/array/initial.js.map +1 -0
  32. package/dist/array/initial.mjs +8 -0
  33. package/dist/array/intersection.mjs +1 -1
  34. package/dist/array/intersectionBy.mjs +1 -1
  35. package/dist/array/intersectionWith.mjs +1 -1
  36. package/dist/array/keyBy.mjs +1 -1
  37. package/dist/array/last.d.mts +25 -0
  38. package/dist/array/last.d.ts +25 -0
  39. package/dist/array/last.js +33 -0
  40. package/dist/array/last.js.map +1 -0
  41. package/dist/array/last.mjs +8 -0
  42. package/dist/array/maxBy.mjs +1 -1
  43. package/dist/array/minBy.mjs +1 -1
  44. package/dist/array/orderBy.mjs +1 -1
  45. package/dist/array/partition.mjs +1 -1
  46. package/dist/array/sample.mjs +1 -1
  47. package/dist/array/sampleSize.mjs +1 -1
  48. package/dist/array/shuffle.mjs +1 -1
  49. package/dist/array/tail.mjs +1 -1
  50. package/dist/array/take.mjs +1 -1
  51. package/dist/array/takeRight.mjs +1 -1
  52. package/dist/array/takeRightWhile.mjs +1 -1
  53. package/dist/array/takeWhile.mjs +1 -1
  54. package/dist/array/toFilled.d.mts +33 -0
  55. package/dist/array/toFilled.d.ts +33 -0
  56. package/dist/array/toFilled.js +40 -0
  57. package/dist/array/toFilled.js.map +1 -0
  58. package/dist/array/toFilled.mjs +8 -0
  59. package/dist/array/union.mjs +1 -1
  60. package/dist/array/unionBy.mjs +1 -1
  61. package/dist/array/unionWith.mjs +1 -1
  62. package/dist/array/uniq.mjs +1 -1
  63. package/dist/array/uniqBy.mjs +1 -1
  64. package/dist/array/uniqWith.mjs +1 -1
  65. package/dist/array/unzip.mjs +1 -1
  66. package/dist/array/unzipWith.mjs +1 -1
  67. package/dist/array/without.mjs +1 -1
  68. package/dist/array/xor.mjs +1 -1
  69. package/dist/array/xorBy.mjs +1 -1
  70. package/dist/array/xorWith.mjs +1 -1
  71. package/dist/array/zip.mjs +1 -1
  72. package/dist/array/zipObject.mjs +1 -1
  73. package/dist/array/zipWith.mjs +1 -1
  74. package/dist/chunk-236H5JZJ.mjs +1 -0
  75. package/dist/chunk-2HIMLZE3.mjs +46 -0
  76. package/dist/chunk-2HIMLZE3.mjs.map +1 -0
  77. package/dist/chunk-2MRZANXZ.mjs +1 -0
  78. package/dist/chunk-2MRZANXZ.mjs.map +1 -0
  79. package/dist/chunk-2SLTL4KL.mjs +13 -0
  80. package/dist/{chunk-NOFHNJ5C.mjs.map → chunk-2SLTL4KL.mjs.map} +1 -1
  81. package/dist/{chunk-QZITBKWX.mjs → chunk-4E4D3BMI.mjs} +2 -2
  82. package/dist/chunk-5IKVJGHO.mjs +14 -0
  83. package/dist/chunk-5IKVJGHO.mjs.map +1 -0
  84. package/dist/chunk-ASJF5D6C.mjs +1 -0
  85. package/dist/chunk-ASJF5D6C.mjs.map +1 -0
  86. package/dist/chunk-BOOQBJN2.mjs +9 -0
  87. package/dist/chunk-BOOQBJN2.mjs.map +1 -0
  88. package/dist/chunk-EYYZQFOP.mjs +14 -0
  89. package/dist/chunk-EYYZQFOP.mjs.map +1 -0
  90. package/dist/chunk-F3WCQQET.mjs +14 -0
  91. package/dist/chunk-F3WCQQET.mjs.map +1 -0
  92. package/dist/{chunk-LT6E4Y4Z.mjs → chunk-GDC64SYJ.mjs} +2 -2
  93. package/dist/{chunk-SDIMTYZW.mjs → chunk-IZAD2S7R.mjs} +2 -2
  94. package/dist/chunk-JYSV56US.mjs +41 -0
  95. package/dist/chunk-JYSV56US.mjs.map +1 -0
  96. package/dist/chunk-KPBQ7OUY.mjs +9 -0
  97. package/dist/chunk-KPBQ7OUY.mjs.map +1 -0
  98. package/dist/chunk-ML727RRJ.mjs +13 -0
  99. package/dist/chunk-ML727RRJ.mjs.map +1 -0
  100. package/dist/chunk-OP4OAKQJ.mjs +16 -0
  101. package/dist/chunk-OP4OAKQJ.mjs.map +1 -0
  102. package/dist/chunk-OSOLEQLZ.mjs +1 -0
  103. package/dist/chunk-OSOLEQLZ.mjs.map +1 -0
  104. package/dist/chunk-QKYYOLJ6.mjs +1 -0
  105. package/dist/chunk-QKYYOLJ6.mjs.map +1 -0
  106. package/dist/chunk-U4JGKZ56.mjs +41 -0
  107. package/dist/chunk-U4JGKZ56.mjs.map +1 -0
  108. package/dist/chunk-U56ZOM7L.mjs +9 -0
  109. package/dist/chunk-U56ZOM7L.mjs.map +1 -0
  110. package/dist/chunk-WMM7TZLG.mjs +9 -0
  111. package/dist/{chunk-OHQAR5AU.mjs.map → chunk-WMM7TZLG.mjs.map} +1 -1
  112. package/dist/chunk-WVQ7YVRK.mjs +11 -0
  113. package/dist/chunk-WVQ7YVRK.mjs.map +1 -0
  114. package/dist/chunk-XGCYC4YA.mjs +5516 -0
  115. package/dist/chunk-XGCYC4YA.mjs.map +1 -0
  116. package/dist/chunk-XPSOKBRZ.mjs +12 -0
  117. package/dist/chunk-XPSOKBRZ.mjs.map +1 -0
  118. package/dist/error/AbortError.mjs +1 -1
  119. package/dist/error/index.mjs +1 -1
  120. package/dist/function/debounce.mjs +1 -1
  121. package/dist/function/index.d.mts +1 -0
  122. package/dist/function/index.d.ts +1 -0
  123. package/dist/function/index.js +7 -0
  124. package/dist/function/index.js.map +1 -1
  125. package/dist/function/index.mjs +6 -2
  126. package/dist/function/negate.d.mts +10 -0
  127. package/dist/function/negate.d.ts +10 -0
  128. package/dist/function/negate.js +33 -0
  129. package/dist/function/negate.js.map +1 -0
  130. package/dist/function/negate.mjs +8 -0
  131. package/dist/function/negate.mjs.map +1 -0
  132. package/dist/function/noop.mjs +1 -1
  133. package/dist/function/once.mjs +1 -1
  134. package/dist/function/throttle.mjs +1 -1
  135. package/dist/index.d.mts +12 -0
  136. package/dist/index.d.ts +12 -0
  137. package/dist/index.js +5681 -3
  138. package/dist/index.js.map +1 -1
  139. package/dist/index.mjs +125 -75
  140. package/dist/math/clamp.mjs +1 -1
  141. package/dist/math/inRange.mjs +1 -1
  142. package/dist/math/index.js +2 -2
  143. package/dist/math/index.js.map +1 -1
  144. package/dist/math/index.mjs +10 -10
  145. package/dist/math/mean.js +2 -2
  146. package/dist/math/mean.js.map +1 -1
  147. package/dist/math/mean.mjs +3 -3
  148. package/dist/math/meanBy.js +2 -2
  149. package/dist/math/meanBy.js.map +1 -1
  150. package/dist/math/meanBy.mjs +4 -4
  151. package/dist/math/random.mjs +1 -1
  152. package/dist/math/randomInt.mjs +1 -1
  153. package/dist/math/range.mjs +1 -1
  154. package/dist/math/round.mjs +1 -1
  155. package/dist/math/sum.js +2 -2
  156. package/dist/math/sum.js.map +1 -1
  157. package/dist/math/sum.mjs +2 -2
  158. package/dist/object/clone.d.mts +31 -0
  159. package/dist/object/clone.d.ts +31 -0
  160. package/dist/object/clone.js +65 -0
  161. package/dist/object/clone.js.map +1 -0
  162. package/dist/object/clone.mjs +8 -0
  163. package/dist/object/clone.mjs.map +1 -0
  164. package/dist/object/index.d.mts +1 -0
  165. package/dist/object/index.d.ts +1 -0
  166. package/dist/object/index.js +39 -0
  167. package/dist/object/index.js.map +1 -1
  168. package/dist/object/index.mjs +7 -3
  169. package/dist/object/invert.mjs +1 -1
  170. package/dist/object/omit.mjs +2 -2
  171. package/dist/object/omitBy.mjs +1 -1
  172. package/dist/object/pick.mjs +1 -1
  173. package/dist/object/pickBy.mjs +1 -1
  174. package/dist/predicate/index.d.mts +1 -0
  175. package/dist/predicate/index.d.ts +1 -0
  176. package/dist/predicate/index.js +46 -1
  177. package/dist/predicate/index.js.map +1 -1
  178. package/dist/predicate/index.mjs +11 -5
  179. package/dist/predicate/isEqual.d.mts +17 -0
  180. package/dist/predicate/isEqual.d.ts +17 -0
  181. package/dist/predicate/isEqual.js +73 -0
  182. package/dist/predicate/isEqual.js.map +1 -0
  183. package/dist/predicate/isEqual.mjs +10 -0
  184. package/dist/predicate/isEqual.mjs.map +1 -0
  185. package/dist/predicate/isNil.js +1 -1
  186. package/dist/predicate/isNil.js.map +1 -1
  187. package/dist/predicate/isNil.mjs +2 -2
  188. package/dist/predicate/isNotNil.mjs +1 -1
  189. package/dist/predicate/isNull.mjs +1 -1
  190. package/dist/predicate/isUndefined.mjs +1 -1
  191. package/dist/promise/delay.mjs +1 -1
  192. package/dist/promise/index.mjs +1 -1
  193. package/dist/string/camelCase.d.mts +17 -0
  194. package/dist/string/camelCase.d.ts +17 -0
  195. package/dist/string/camelCase.js +5554 -0
  196. package/dist/string/camelCase.js.map +1 -0
  197. package/dist/string/camelCase.mjs +9 -0
  198. package/dist/string/camelCase.mjs.map +1 -0
  199. package/dist/string/capitalize.d.mts +14 -0
  200. package/dist/string/capitalize.d.ts +14 -0
  201. package/dist/string/capitalize.js +33 -0
  202. package/dist/string/capitalize.js.map +1 -0
  203. package/dist/string/capitalize.mjs +8 -0
  204. package/dist/string/capitalize.mjs.map +1 -0
  205. package/dist/string/index.d.mts +5 -0
  206. package/dist/string/index.d.ts +5 -0
  207. package/dist/string/index.js +5587 -0
  208. package/dist/string/index.js.map +1 -0
  209. package/dist/string/index.mjs +26 -0
  210. package/dist/string/index.mjs.map +1 -0
  211. package/dist/string/kebabCase.d.mts +17 -0
  212. package/dist/string/kebabCase.d.ts +17 -0
  213. package/dist/string/kebabCase.js +43 -0
  214. package/dist/string/kebabCase.js.map +1 -0
  215. package/dist/string/kebabCase.mjs +9 -0
  216. package/dist/string/kebabCase.mjs.map +1 -0
  217. package/dist/string/lowerCase.d.mts +17 -0
  218. package/dist/string/lowerCase.d.ts +17 -0
  219. package/dist/string/lowerCase.js +43 -0
  220. package/dist/string/lowerCase.js.map +1 -0
  221. package/dist/string/lowerCase.mjs +9 -0
  222. package/dist/string/lowerCase.mjs.map +1 -0
  223. package/dist/string/snakeCase.d.mts +17 -0
  224. package/dist/string/snakeCase.d.ts +17 -0
  225. package/dist/string/snakeCase.js +43 -0
  226. package/dist/string/snakeCase.js.map +1 -0
  227. package/dist/string/snakeCase.mjs +9 -0
  228. package/dist/string/snakeCase.mjs.map +1 -0
  229. package/package.json +21 -1
  230. package/string.d.ts +1 -0
  231. package/dist/chunk-2MM5EJJX.mjs +0 -21
  232. package/dist/chunk-LOY6PATI.mjs +0 -1
  233. package/dist/chunk-MAJSPFA6.mjs +0 -1
  234. package/dist/chunk-N6EM6ETS.mjs +0 -1
  235. package/dist/chunk-NOFHNJ5C.mjs +0 -13
  236. package/dist/chunk-OHQAR5AU.mjs +0 -9
  237. package/dist/chunk-PMHULJNL.mjs +0 -1
  238. /package/dist/{chunk-2MM5EJJX.mjs.map → array/flattenDeep.mjs.map} +0 -0
  239. /package/dist/{chunk-LOY6PATI.mjs.map → array/initial.mjs.map} +0 -0
  240. /package/dist/{chunk-MAJSPFA6.mjs.map → array/last.mjs.map} +0 -0
  241. /package/dist/{chunk-N6EM6ETS.mjs.map → array/toFilled.mjs.map} +0 -0
  242. /package/dist/{chunk-PMHULJNL.mjs.map → chunk-236H5JZJ.mjs.map} +0 -0
  243. /package/dist/{chunk-QZITBKWX.mjs.map → chunk-4E4D3BMI.mjs.map} +0 -0
  244. /package/dist/{chunk-LT6E4Y4Z.mjs.map → chunk-GDC64SYJ.mjs.map} +0 -0
  245. /package/dist/{chunk-SDIMTYZW.mjs.map → chunk-IZAD2S7R.mjs.map} +0 -0
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/array/initial.ts
21
+ var initial_exports = {};
22
+ __export(initial_exports, {
23
+ initial: () => initial
24
+ });
25
+ module.exports = __toCommonJS(initial_exports);
26
+ function initial(arr) {
27
+ if (arr.length <= 1) {
28
+ return [];
29
+ }
30
+ return arr.slice(0, -1);
31
+ }
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ initial
35
+ });
36
+ //# sourceMappingURL=initial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/array/initial.ts"],"sourcesContent":["/**\n * Returns a new array containing all elements except the last one from the input array.\n * If the input array is empty or has only one element, the function returns an empty array.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The input array to query.\n * @returns {T[]} A new array containing all but the last element of the input array.\n *\n * @example\n * const arr = [1, 2, 3, 4];\n * const newArr = initial(arr);\n * // newArr will be [1, 2, 3]\n *\n * @example\n * const emptyArr: number[] = [];\n * const newEmptyArr = initial(emptyArr);\n * // newEmptyArr will be []\n *\n * @example\n * const singleElementArr = ['only one'];\n * const newSingleElementArr = initial(singleElementArr);\n * // newSingleElementArr will be []\n */\nexport function initial<T>(arr: T[]): T[] {\n if (arr.length <= 1) {\n return [];\n }\n return arr.slice(0, -1);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBO,SAAS,QAAW,KAAe;AACxC,MAAI,IAAI,UAAU,GAAG;AACnB,WAAO,CAAC;AAAA,EACV;AACA,SAAO,IAAI,MAAM,GAAG,EAAE;AACxB;","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ initial
3
+ } from "../chunk-XPSOKBRZ.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
+ export {
6
+ initial
7
+ };
8
+ //# sourceMappingURL=initial.mjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  intersection
3
3
  } from "../chunk-FVVSE2F2.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  intersection
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  intersectionBy
3
3
  } from "../chunk-O6UXZR3U.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  intersectionBy
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  intersectionWith
3
3
  } from "../chunk-XI7KRD2C.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  intersectionWith
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  keyBy
3
3
  } from "../chunk-AJKZMN2V.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  keyBy
7
7
  };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Returns the last element of an array.
3
+ *
4
+ * This function takes an array and returns the last element of the array.
5
+ * If the array is empty, the function returns `undefined`.
6
+ *
7
+ * Unlike some implementations, this function is optimized for performance
8
+ * by directly accessing the last index of the array.
9
+ *
10
+ * @param {T[]} arr - The array from which to get the last element.
11
+ * @returns {T | undefined} The last element of the array, or `undefined` if the array is empty.
12
+ *
13
+ * @example
14
+ * const arr = [1, 2, 3];
15
+ * const lastElement = last(arr);
16
+ * // lastElement will be 3
17
+ *
18
+ * const emptyArr: number[] = [];
19
+ * const noElement = last(emptyArr);
20
+ * // noElement will be undefined
21
+ */
22
+ declare function last<T>(arr: readonly [...T[], T]): T;
23
+ declare function last<T>(arr: readonly T[]): T | undefined;
24
+
25
+ export { last };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Returns the last element of an array.
3
+ *
4
+ * This function takes an array and returns the last element of the array.
5
+ * If the array is empty, the function returns `undefined`.
6
+ *
7
+ * Unlike some implementations, this function is optimized for performance
8
+ * by directly accessing the last index of the array.
9
+ *
10
+ * @param {T[]} arr - The array from which to get the last element.
11
+ * @returns {T | undefined} The last element of the array, or `undefined` if the array is empty.
12
+ *
13
+ * @example
14
+ * const arr = [1, 2, 3];
15
+ * const lastElement = last(arr);
16
+ * // lastElement will be 3
17
+ *
18
+ * const emptyArr: number[] = [];
19
+ * const noElement = last(emptyArr);
20
+ * // noElement will be undefined
21
+ */
22
+ declare function last<T>(arr: readonly [...T[], T]): T;
23
+ declare function last<T>(arr: readonly T[]): T | undefined;
24
+
25
+ export { last };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/array/last.ts
21
+ var last_exports = {};
22
+ __export(last_exports, {
23
+ last: () => last
24
+ });
25
+ module.exports = __toCommonJS(last_exports);
26
+ function last(arr) {
27
+ return arr[arr.length - 1];
28
+ }
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ last
32
+ });
33
+ //# sourceMappingURL=last.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/array/last.ts"],"sourcesContent":["/**\n * Returns the last element of an array.\n *\n * This function takes an array and returns the last element of the array.\n * If the array is empty, the function returns `undefined`.\n *\n * Unlike some implementations, this function is optimized for performance\n * by directly accessing the last index of the array.\n *\n * @param {T[]} arr - The array from which to get the last element.\n * @returns {T | undefined} The last element of the array, or `undefined` if the array is empty.\n *\n * @example\n * const arr = [1, 2, 3];\n * const lastElement = last(arr);\n * // lastElement will be 3\n *\n * const emptyArr: number[] = [];\n * const noElement = last(emptyArr);\n * // noElement will be undefined\n */\n\nexport function last<T>(arr: readonly [...T[], T]): T;\nexport function last<T>(arr: readonly T[]): T | undefined;\nexport function last<T>(arr: readonly T[]): T | undefined {\n return arr[arr.length - 1];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBO,SAAS,KAAQ,KAAkC;AACxD,SAAO,IAAI,IAAI,SAAS,CAAC;AAC3B;","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ last
3
+ } from "../chunk-KPBQ7OUY.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
+ export {
6
+ last
7
+ };
8
+ //# sourceMappingURL=last.mjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  maxBy
3
3
  } from "../chunk-OOKNBU4V.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  maxBy
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  minBy
3
3
  } from "../chunk-IJD7FE2Z.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
5
  export {
6
6
  minBy
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  orderBy
3
3
  } from "../chunk-7B7W36UP.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.mjs";
5
5
  export {
6
6
  takeWhile
7
7
  };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Creates a new array filled with the specified value from the start position up to, but not including, the end position.
3
+ * This function does not mutate the original array.
4
+ *
5
+ * @param {Array<T>} arr - The array to base the new array on.
6
+ * @param {U} value - The value to fill the new array with.
7
+ * @param {number} [start=0] - The start position. Defaults to 0.
8
+ * @param {number} [end=arr.length] - The end position. Defaults to the array's length.
9
+ * @returns {Array<T | U>} The new array with the filled values.
10
+ *
11
+ * @example
12
+ * const array = [1, 2, 3, 4, 5];
13
+ * let result = toFilled(array, '*', 2);
14
+ * console.log(result); // [1, 2, '*', '*', '*']
15
+ * console.log(array); // [1, 2, 3, 4, 5]
16
+ *
17
+ * result = toFilled(array, '*', 1, 4);
18
+ * console.log(result); // [1, '*', '*', '*', 5]
19
+ * console.log(array); // [1, 2, 3, 4, 5]
20
+ *
21
+ * result = toFilled(array, '*');
22
+ * console.log(result); // ['*', '*', '*', '*', '*']
23
+ * console.log(array); // [1, 2, 3, 4, 5]
24
+ *
25
+ * result = toFilled(array, '*', -4, -1);
26
+ * console.log(result); // [1, '*', '*', '*', 5]
27
+ * console.log(array); // [1, 2, 3, 4, 5]
28
+ */
29
+ declare function toFilled<T, U>(arr: T[], value: U): Array<T | U>;
30
+ declare function toFilled<T, U>(arr: T[], value: U, start: number): Array<T | U>;
31
+ declare function toFilled<T, U>(arr: T[], value: U, start: number, end: number): Array<T | U>;
32
+
33
+ export { toFilled };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Creates a new array filled with the specified value from the start position up to, but not including, the end position.
3
+ * This function does not mutate the original array.
4
+ *
5
+ * @param {Array<T>} arr - The array to base the new array on.
6
+ * @param {U} value - The value to fill the new array with.
7
+ * @param {number} [start=0] - The start position. Defaults to 0.
8
+ * @param {number} [end=arr.length] - The end position. Defaults to the array's length.
9
+ * @returns {Array<T | U>} The new array with the filled values.
10
+ *
11
+ * @example
12
+ * const array = [1, 2, 3, 4, 5];
13
+ * let result = toFilled(array, '*', 2);
14
+ * console.log(result); // [1, 2, '*', '*', '*']
15
+ * console.log(array); // [1, 2, 3, 4, 5]
16
+ *
17
+ * result = toFilled(array, '*', 1, 4);
18
+ * console.log(result); // [1, '*', '*', '*', 5]
19
+ * console.log(array); // [1, 2, 3, 4, 5]
20
+ *
21
+ * result = toFilled(array, '*');
22
+ * console.log(result); // ['*', '*', '*', '*', '*']
23
+ * console.log(array); // [1, 2, 3, 4, 5]
24
+ *
25
+ * result = toFilled(array, '*', -4, -1);
26
+ * console.log(result); // [1, '*', '*', '*', 5]
27
+ * console.log(array); // [1, 2, 3, 4, 5]
28
+ */
29
+ declare function toFilled<T, U>(arr: T[], value: U): Array<T | U>;
30
+ declare function toFilled<T, U>(arr: T[], value: U, start: number): Array<T | U>;
31
+ declare function toFilled<T, U>(arr: T[], value: U, start: number, end: number): Array<T | U>;
32
+
33
+ export { toFilled };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/array/toFilled.ts
21
+ var toFilled_exports = {};
22
+ __export(toFilled_exports, {
23
+ toFilled: () => toFilled
24
+ });
25
+ module.exports = __toCommonJS(toFilled_exports);
26
+ function toFilled(arr, value, start = 0, end = arr.length) {
27
+ const length = arr.length;
28
+ const finalStart = Math.max(start >= 0 ? start : length + start, 0);
29
+ const finalEnd = Math.min(end >= 0 ? end : length + end, length);
30
+ const newArr = arr.slice();
31
+ for (let i = finalStart; i < finalEnd; i++) {
32
+ newArr[i] = value;
33
+ }
34
+ return newArr;
35
+ }
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ toFilled
39
+ });
40
+ //# sourceMappingURL=toFilled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/array/toFilled.ts"],"sourcesContent":["/**\n * Creates a new array filled with the specified value from the start position up to, but not including, the end position.\n * This function does not mutate the original array.\n *\n * @param {Array<T>} arr - The array to base the new array on.\n * @param {U} value - The value to fill the new array with.\n * @param {number} [start=0] - The start position. Defaults to 0.\n * @param {number} [end=arr.length] - The end position. Defaults to the array's length.\n * @returns {Array<T | U>} The new array with the filled values.\n *\n * @example\n * const array = [1, 2, 3, 4, 5];\n * let result = toFilled(array, '*', 2);\n * console.log(result); // [1, 2, '*', '*', '*']\n * console.log(array); // [1, 2, 3, 4, 5]\n *\n * result = toFilled(array, '*', 1, 4);\n * console.log(result); // [1, '*', '*', '*', 5]\n * console.log(array); // [1, 2, 3, 4, 5]\n *\n * result = toFilled(array, '*');\n * console.log(result); // ['*', '*', '*', '*', '*']\n * console.log(array); // [1, 2, 3, 4, 5]\n *\n * result = toFilled(array, '*', -4, -1);\n * console.log(result); // [1, '*', '*', '*', 5]\n * console.log(array); // [1, 2, 3, 4, 5]\n */\n\nexport function toFilled<T, U>(arr: T[], value: U): Array<T | U>;\nexport function toFilled<T, U>(arr: T[], value: U, start: number): Array<T | U>;\nexport function toFilled<T, U>(arr: T[], value: U, start: number, end: number): Array<T | U>;\nexport function toFilled<T, U>(arr: T[], value: U, start = 0, end = arr.length): Array<T | U> {\n const length = arr.length;\n const finalStart = Math.max(start >= 0 ? start : length + start, 0);\n const finalEnd = Math.min(end >= 0 ? end : length + end, length);\n\n const newArr: Array<T | U> = arr.slice();\n\n for (let i = finalStart; i < finalEnd; i++) {\n newArr[i] = value;\n }\n\n return newArr;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCO,SAAS,SAAe,KAAU,OAAU,QAAQ,GAAG,MAAM,IAAI,QAAsB;AAC5F,QAAM,SAAS,IAAI;AACnB,QAAM,aAAa,KAAK,IAAI,SAAS,IAAI,QAAQ,SAAS,OAAO,CAAC;AAClE,QAAM,WAAW,KAAK,IAAI,OAAO,IAAI,MAAM,SAAS,KAAK,MAAM;AAE/D,QAAM,SAAuB,IAAI,MAAM;AAEvC,WAAS,IAAI,YAAY,IAAI,UAAU,KAAK;AAC1C,WAAO,CAAC,IAAI;AAAA,EACd;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ toFilled
3
+ } from "../chunk-OP4OAKQJ.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
+ export {
6
+ toFilled
7
+ };
8
+ //# sourceMappingURL=toFilled.mjs.map
@@ -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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.mjs";
5
5
  export {
6
6
  uniq
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  uniqBy
3
3
  } from "../chunk-OXAZEEGP.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.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-2HIMLZE3.mjs";
5
5
  export {
6
6
  zipWith
7
7
  };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-236H5JZJ.mjs.map
@@ -0,0 +1,46 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __commonJS = (cb, mod) => function __require() {
22
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
23
+ };
24
+ var __copyProps = (to, from, except, desc) => {
25
+ if (from && typeof from === "object" || typeof from === "function") {
26
+ for (let key of __getOwnPropNames(from))
27
+ if (!__hasOwnProp.call(to, key) && key !== except)
28
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
+ }
30
+ return to;
31
+ };
32
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
33
+ // If the importer is in node compatibility mode or this is not an ESM
34
+ // file that has been converted to a CommonJS file using a Babel-
35
+ // compatible transform (i.e. "__esModule" has not been set), then set
36
+ // "default" to the CommonJS "module.exports" for node compatibility.
37
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
38
+ mod
39
+ ));
40
+
41
+ export {
42
+ __spreadValues,
43
+ __commonJS,
44
+ __toESM
45
+ };
46
+ //# sourceMappingURL=chunk-2HIMLZE3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-2MRZANXZ.mjs.map