es-toolkit 1.9.0 → 1.10.0-dev.204
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.
- package/CHANGELOG.md +22 -1
- package/README.md +1 -1
- package/dist/array/chunk.mjs +1 -1
- package/dist/array/compact.mjs +1 -1
- package/dist/array/countBy.mjs +1 -1
- package/dist/array/difference.mjs +1 -1
- package/dist/array/differenceBy.mjs +1 -1
- package/dist/array/differenceWith.mjs +1 -1
- package/dist/array/drop.mjs +1 -1
- package/dist/array/dropRight.mjs +1 -1
- package/dist/array/dropRightWhile.mjs +1 -1
- package/dist/array/dropWhile.mjs +1 -1
- package/dist/array/fill.mjs +1 -1
- package/dist/array/flatten.mjs +1 -1
- package/dist/array/flattenDeep.d.mts +25 -0
- package/dist/array/flattenDeep.d.ts +25 -0
- package/dist/array/flattenDeep.js +52 -0
- package/dist/array/flattenDeep.js.map +1 -0
- package/dist/array/flattenDeep.mjs +9 -0
- package/dist/array/forEachRight.mjs +1 -1
- package/dist/array/groupBy.mjs +1 -1
- package/dist/array/head.mjs +1 -1
- package/dist/array/index.d.mts +4 -0
- package/dist/array/index.d.ts +4 -0
- package/dist/array/index.js +38 -0
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +45 -29
- package/dist/array/initial.d.mts +26 -0
- package/dist/array/initial.d.ts +26 -0
- package/dist/array/initial.js +36 -0
- package/dist/array/initial.js.map +1 -0
- package/dist/array/initial.mjs +8 -0
- package/dist/array/intersection.mjs +1 -1
- package/dist/array/intersectionBy.mjs +1 -1
- package/dist/array/intersectionWith.mjs +1 -1
- package/dist/array/keyBy.mjs +1 -1
- package/dist/array/last.d.mts +25 -0
- package/dist/array/last.d.ts +25 -0
- package/dist/array/last.js +33 -0
- package/dist/array/last.js.map +1 -0
- package/dist/array/last.mjs +8 -0
- package/dist/array/maxBy.mjs +1 -1
- package/dist/array/minBy.mjs +1 -1
- package/dist/array/orderBy.mjs +1 -1
- package/dist/array/partition.mjs +1 -1
- package/dist/array/sample.mjs +1 -1
- package/dist/array/sampleSize.mjs +1 -1
- package/dist/array/shuffle.mjs +1 -1
- package/dist/array/tail.mjs +1 -1
- package/dist/array/take.mjs +1 -1
- package/dist/array/takeRight.mjs +1 -1
- package/dist/array/takeRightWhile.mjs +1 -1
- package/dist/array/takeWhile.mjs +1 -1
- package/dist/array/toFilled.d.mts +33 -0
- package/dist/array/toFilled.d.ts +33 -0
- package/dist/array/toFilled.js +40 -0
- package/dist/array/toFilled.js.map +1 -0
- package/dist/array/toFilled.mjs +8 -0
- package/dist/array/union.mjs +1 -1
- package/dist/array/unionBy.mjs +1 -1
- package/dist/array/unionWith.mjs +1 -1
- package/dist/array/uniq.mjs +1 -1
- package/dist/array/uniqBy.mjs +1 -1
- package/dist/array/uniqWith.mjs +1 -1
- package/dist/array/unzip.mjs +1 -1
- package/dist/array/unzipWith.mjs +1 -1
- package/dist/array/without.mjs +1 -1
- package/dist/array/xor.mjs +1 -1
- package/dist/array/xorBy.mjs +1 -1
- package/dist/array/xorWith.mjs +1 -1
- package/dist/array/zip.mjs +1 -1
- package/dist/array/zipObject.mjs +1 -1
- package/dist/array/zipWith.mjs +1 -1
- package/dist/chunk-236H5JZJ.mjs +1 -0
- package/dist/chunk-2HIMLZE3.mjs +46 -0
- package/dist/chunk-2HIMLZE3.mjs.map +1 -0
- package/dist/chunk-2MRZANXZ.mjs +1 -0
- package/dist/chunk-2MRZANXZ.mjs.map +1 -0
- package/dist/chunk-2SLTL4KL.mjs +13 -0
- package/dist/{chunk-NOFHNJ5C.mjs.map → chunk-2SLTL4KL.mjs.map} +1 -1
- package/dist/{chunk-QZITBKWX.mjs → chunk-4E4D3BMI.mjs} +2 -2
- package/dist/chunk-5IKVJGHO.mjs +14 -0
- package/dist/chunk-5IKVJGHO.mjs.map +1 -0
- package/dist/chunk-ASJF5D6C.mjs +1 -0
- package/dist/chunk-ASJF5D6C.mjs.map +1 -0
- package/dist/chunk-BOOQBJN2.mjs +9 -0
- package/dist/chunk-BOOQBJN2.mjs.map +1 -0
- package/dist/chunk-EYYZQFOP.mjs +14 -0
- package/dist/chunk-EYYZQFOP.mjs.map +1 -0
- package/dist/chunk-F3WCQQET.mjs +14 -0
- package/dist/chunk-F3WCQQET.mjs.map +1 -0
- package/dist/{chunk-LT6E4Y4Z.mjs → chunk-GDC64SYJ.mjs} +2 -2
- package/dist/{chunk-SDIMTYZW.mjs → chunk-IZAD2S7R.mjs} +2 -2
- package/dist/chunk-JYSV56US.mjs +41 -0
- package/dist/chunk-JYSV56US.mjs.map +1 -0
- package/dist/chunk-KPBQ7OUY.mjs +9 -0
- package/dist/chunk-KPBQ7OUY.mjs.map +1 -0
- package/dist/chunk-ML727RRJ.mjs +13 -0
- package/dist/chunk-ML727RRJ.mjs.map +1 -0
- package/dist/chunk-NKLIE2OI.mjs +1 -0
- package/dist/chunk-NKLIE2OI.mjs.map +1 -0
- package/dist/chunk-OP4OAKQJ.mjs +16 -0
- package/dist/chunk-OP4OAKQJ.mjs.map +1 -0
- package/dist/chunk-OSOLEQLZ.mjs +1 -0
- package/dist/chunk-OSOLEQLZ.mjs.map +1 -0
- package/dist/chunk-QKYYOLJ6.mjs +1 -0
- package/dist/chunk-QKYYOLJ6.mjs.map +1 -0
- package/dist/chunk-U4JGKZ56.mjs +41 -0
- package/dist/chunk-U4JGKZ56.mjs.map +1 -0
- package/dist/chunk-U56ZOM7L.mjs +9 -0
- package/dist/chunk-U56ZOM7L.mjs.map +1 -0
- package/dist/chunk-WMM7TZLG.mjs +9 -0
- package/dist/{chunk-OHQAR5AU.mjs.map → chunk-WMM7TZLG.mjs.map} +1 -1
- package/dist/chunk-WVQ7YVRK.mjs +11 -0
- package/dist/chunk-WVQ7YVRK.mjs.map +1 -0
- package/dist/chunk-XGCYC4YA.mjs +5516 -0
- package/dist/chunk-XGCYC4YA.mjs.map +1 -0
- package/dist/chunk-XPSOKBRZ.mjs +12 -0
- package/dist/chunk-XPSOKBRZ.mjs.map +1 -0
- package/dist/compat/index.d.mts +108 -0
- package/dist/compat/index.d.ts +108 -0
- package/dist/compat/index.js +6578 -0
- package/dist/compat/index.js.map +1 -0
- package/dist/compat/index.mjs +351 -0
- package/dist/compat/index.mjs.map +1 -0
- package/dist/error/AbortError.mjs +1 -1
- package/dist/error/index.mjs +1 -1
- package/dist/function/debounce.mjs +1 -1
- package/dist/function/index.d.mts +1 -0
- package/dist/function/index.d.ts +1 -0
- package/dist/function/index.js +7 -0
- package/dist/function/index.js.map +1 -1
- package/dist/function/index.mjs +8 -4
- package/dist/function/negate.d.mts +10 -0
- package/dist/function/negate.d.ts +10 -0
- package/dist/function/negate.js +33 -0
- package/dist/function/negate.js.map +1 -0
- package/dist/function/negate.mjs +8 -0
- package/dist/function/negate.mjs.map +1 -0
- package/dist/function/noop.mjs +1 -1
- package/dist/function/once.mjs +1 -1
- package/dist/function/throttle.mjs +1 -1
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +5681 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -50
- package/dist/math/clamp.mjs +1 -1
- package/dist/math/inRange.mjs +1 -1
- package/dist/math/index.js +2 -2
- package/dist/math/index.js.map +1 -1
- package/dist/math/index.mjs +9 -9
- package/dist/math/mean.js +2 -2
- package/dist/math/mean.js.map +1 -1
- package/dist/math/mean.mjs +3 -3
- package/dist/math/meanBy.js +2 -2
- package/dist/math/meanBy.js.map +1 -1
- package/dist/math/meanBy.mjs +4 -4
- package/dist/math/random.mjs +1 -1
- package/dist/math/randomInt.mjs +1 -1
- package/dist/math/range.mjs +1 -1
- package/dist/math/round.mjs +1 -1
- package/dist/math/sum.js +2 -2
- package/dist/math/sum.js.map +1 -1
- package/dist/math/sum.mjs +2 -2
- package/dist/object/clone.d.mts +31 -0
- package/dist/object/clone.d.ts +31 -0
- package/dist/object/clone.js +65 -0
- package/dist/object/clone.js.map +1 -0
- package/dist/object/clone.mjs +8 -0
- package/dist/object/clone.mjs.map +1 -0
- package/dist/object/index.d.mts +1 -0
- package/dist/object/index.d.ts +1 -0
- package/dist/object/index.js +39 -0
- package/dist/object/index.js.map +1 -1
- package/dist/object/index.mjs +7 -3
- package/dist/object/invert.mjs +1 -1
- package/dist/object/omit.mjs +2 -2
- package/dist/object/omitBy.mjs +1 -1
- package/dist/object/pick.mjs +1 -1
- package/dist/object/pickBy.mjs +1 -1
- package/dist/predicate/index.d.mts +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +46 -1
- package/dist/predicate/index.js.map +1 -1
- package/dist/predicate/index.mjs +9 -3
- package/dist/predicate/isEqual.d.mts +17 -0
- package/dist/predicate/isEqual.d.ts +17 -0
- package/dist/predicate/isEqual.js +73 -0
- package/dist/predicate/isEqual.js.map +1 -0
- package/dist/predicate/isEqual.mjs +10 -0
- package/dist/predicate/isEqual.mjs.map +1 -0
- package/dist/predicate/isNil.js +1 -1
- package/dist/predicate/isNil.js.map +1 -1
- package/dist/predicate/isNil.mjs +2 -2
- package/dist/predicate/isNotNil.mjs +1 -1
- package/dist/predicate/isNull.mjs +1 -1
- package/dist/predicate/isUndefined.mjs +1 -1
- package/dist/promise/delay.mjs +1 -1
- package/dist/promise/index.mjs +1 -1
- package/dist/string/camelCase.d.mts +17 -0
- package/dist/string/camelCase.d.ts +17 -0
- package/dist/string/camelCase.js +5554 -0
- package/dist/string/camelCase.js.map +1 -0
- package/dist/string/camelCase.mjs +9 -0
- package/dist/string/camelCase.mjs.map +1 -0
- package/dist/string/capitalize.d.mts +14 -0
- package/dist/string/capitalize.d.ts +14 -0
- package/dist/string/capitalize.js +33 -0
- package/dist/string/capitalize.js.map +1 -0
- package/dist/string/capitalize.mjs +8 -0
- package/dist/string/capitalize.mjs.map +1 -0
- package/dist/string/index.d.mts +5 -0
- package/dist/string/index.d.ts +5 -0
- package/dist/string/index.js +5587 -0
- package/dist/string/index.js.map +1 -0
- package/dist/string/index.mjs +26 -0
- package/dist/string/index.mjs.map +1 -0
- package/dist/string/kebabCase.d.mts +17 -0
- package/dist/string/kebabCase.d.ts +17 -0
- package/dist/string/kebabCase.js +43 -0
- package/dist/string/kebabCase.js.map +1 -0
- package/dist/string/kebabCase.mjs +9 -0
- package/dist/string/kebabCase.mjs.map +1 -0
- package/dist/string/lowerCase.d.mts +17 -0
- package/dist/string/lowerCase.d.ts +17 -0
- package/dist/string/lowerCase.js +43 -0
- package/dist/string/lowerCase.js.map +1 -0
- package/dist/string/lowerCase.mjs +9 -0
- package/dist/string/lowerCase.mjs.map +1 -0
- package/dist/string/snakeCase.d.mts +17 -0
- package/dist/string/snakeCase.d.ts +17 -0
- package/dist/string/snakeCase.js +43 -0
- package/dist/string/snakeCase.js.map +1 -0
- package/dist/string/snakeCase.mjs +9 -0
- package/dist/string/snakeCase.mjs.map +1 -0
- package/package.json +21 -1
- package/string.d.ts +1 -0
- package/dist/chunk-2MM5EJJX.mjs +0 -21
- package/dist/chunk-LOY6PATI.mjs +0 -1
- package/dist/chunk-MAJSPFA6.mjs +0 -1
- package/dist/chunk-N6EM6ETS.mjs +0 -1
- package/dist/chunk-NOFHNJ5C.mjs +0 -13
- package/dist/chunk-OHQAR5AU.mjs +0 -9
- package/dist/chunk-PMHULJNL.mjs +0 -1
- /package/dist/{chunk-2MM5EJJX.mjs.map → array/flattenDeep.mjs.map} +0 -0
- /package/dist/{chunk-LOY6PATI.mjs.map → array/initial.mjs.map} +0 -0
- /package/dist/{chunk-MAJSPFA6.mjs.map → array/last.mjs.map} +0 -0
- /package/dist/{chunk-N6EM6ETS.mjs.map → array/toFilled.mjs.map} +0 -0
- /package/dist/{chunk-PMHULJNL.mjs.map → chunk-236H5JZJ.mjs.map} +0 -0
- /package/dist/{chunk-QZITBKWX.mjs.map → chunk-4E4D3BMI.mjs.map} +0 -0
- /package/dist/{chunk-LT6E4Y4Z.mjs.map → chunk-GDC64SYJ.mjs.map} +0 -0
- /package/dist/{chunk-SDIMTYZW.mjs.map → chunk-IZAD2S7R.mjs.map} +0 -0
|
@@ -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":";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,108 @@
|
|
|
1
|
+
export { compact } from '../array/compact.mjs';
|
|
2
|
+
export { countBy } from '../array/countBy.mjs';
|
|
3
|
+
export { difference } from '../array/difference.mjs';
|
|
4
|
+
export { differenceBy } from '../array/differenceBy.mjs';
|
|
5
|
+
export { differenceWith } from '../array/differenceWith.mjs';
|
|
6
|
+
export { drop } from '../array/drop.mjs';
|
|
7
|
+
export { dropRight } from '../array/dropRight.mjs';
|
|
8
|
+
export { dropRightWhile } from '../array/dropRightWhile.mjs';
|
|
9
|
+
export { dropWhile } from '../array/dropWhile.mjs';
|
|
10
|
+
export { fill } from '../array/fill.mjs';
|
|
11
|
+
export { flatten } from '../array/flatten.mjs';
|
|
12
|
+
export { flattenDeep } from '../array/flattenDeep.mjs';
|
|
13
|
+
export { forEachRight } from '../array/forEachRight.mjs';
|
|
14
|
+
export { groupBy } from '../array/groupBy.mjs';
|
|
15
|
+
export { intersection } from '../array/intersection.mjs';
|
|
16
|
+
export { intersectionBy } from '../array/intersectionBy.mjs';
|
|
17
|
+
export { intersectionWith } from '../array/intersectionWith.mjs';
|
|
18
|
+
export { keyBy } from '../array/keyBy.mjs';
|
|
19
|
+
export { maxBy } from '../array/maxBy.mjs';
|
|
20
|
+
export { minBy } from '../array/minBy.mjs';
|
|
21
|
+
export { orderBy } from '../array/orderBy.mjs';
|
|
22
|
+
export { partition } from '../array/partition.mjs';
|
|
23
|
+
export { sample } from '../array/sample.mjs';
|
|
24
|
+
export { sampleSize } from '../array/sampleSize.mjs';
|
|
25
|
+
export { shuffle } from '../array/shuffle.mjs';
|
|
26
|
+
export { take } from '../array/take.mjs';
|
|
27
|
+
export { takeRight } from '../array/takeRight.mjs';
|
|
28
|
+
export { takeRightWhile } from '../array/takeRightWhile.mjs';
|
|
29
|
+
export { takeWhile } from '../array/takeWhile.mjs';
|
|
30
|
+
export { union } from '../array/union.mjs';
|
|
31
|
+
export { unionBy } from '../array/unionBy.mjs';
|
|
32
|
+
export { unionWith } from '../array/unionWith.mjs';
|
|
33
|
+
export { uniq } from '../array/uniq.mjs';
|
|
34
|
+
export { uniqBy } from '../array/uniqBy.mjs';
|
|
35
|
+
export { uniqWith } from '../array/uniqWith.mjs';
|
|
36
|
+
export { unzip } from '../array/unzip.mjs';
|
|
37
|
+
export { unzipWith } from '../array/unzipWith.mjs';
|
|
38
|
+
export { xor } from '../array/xor.mjs';
|
|
39
|
+
export { xorBy } from '../array/xorBy.mjs';
|
|
40
|
+
export { xorWith } from '../array/xorWith.mjs';
|
|
41
|
+
export { zip } from '../array/zip.mjs';
|
|
42
|
+
export { zipObject } from '../array/zipObject.mjs';
|
|
43
|
+
export { zipWith } from '../array/zipWith.mjs';
|
|
44
|
+
export { without } from '../array/without.mjs';
|
|
45
|
+
export { head } from '../array/head.mjs';
|
|
46
|
+
export { tail } from '../array/tail.mjs';
|
|
47
|
+
export { toFilled } from '../array/toFilled.mjs';
|
|
48
|
+
export { last } from '../array/last.mjs';
|
|
49
|
+
export { initial } from '../array/initial.mjs';
|
|
50
|
+
export { AbortError } from '../error/AbortError.mjs';
|
|
51
|
+
export { debounce } from '../function/debounce.mjs';
|
|
52
|
+
export { noop } from '../function/noop.mjs';
|
|
53
|
+
export { once } from '../function/once.mjs';
|
|
54
|
+
export { throttle } from '../function/throttle.mjs';
|
|
55
|
+
export { negate } from '../function/negate.mjs';
|
|
56
|
+
export { clamp } from '../math/clamp.mjs';
|
|
57
|
+
export { inRange } from '../math/inRange.mjs';
|
|
58
|
+
export { mean } from '../math/mean.mjs';
|
|
59
|
+
export { meanBy } from '../math/meanBy.mjs';
|
|
60
|
+
export { random } from '../math/random.mjs';
|
|
61
|
+
export { randomInt } from '../math/randomInt.mjs';
|
|
62
|
+
export { round } from '../math/round.mjs';
|
|
63
|
+
export { sum } from '../math/sum.mjs';
|
|
64
|
+
export { range } from '../math/range.mjs';
|
|
65
|
+
export { omit } from '../object/omit.mjs';
|
|
66
|
+
export { omitBy } from '../object/omitBy.mjs';
|
|
67
|
+
export { pick } from '../object/pick.mjs';
|
|
68
|
+
export { pickBy } from '../object/pickBy.mjs';
|
|
69
|
+
export { invert } from '../object/invert.mjs';
|
|
70
|
+
export { clone } from '../object/clone.mjs';
|
|
71
|
+
export { isEqual } from '../predicate/isEqual.mjs';
|
|
72
|
+
export { isNil } from '../predicate/isNil.mjs';
|
|
73
|
+
export { isNotNil } from '../predicate/isNotNil.mjs';
|
|
74
|
+
export { isNull } from '../predicate/isNull.mjs';
|
|
75
|
+
export { isUndefined } from '../predicate/isUndefined.mjs';
|
|
76
|
+
export { delay } from '../promise/delay.mjs';
|
|
77
|
+
export { camelCase } from '../string/camelCase.mjs';
|
|
78
|
+
export { snakeCase } from '../string/snakeCase.mjs';
|
|
79
|
+
export { kebabCase } from '../string/kebabCase.mjs';
|
|
80
|
+
export { lowerCase } from '../string/lowerCase.mjs';
|
|
81
|
+
export { capitalize } from '../string/capitalize.mjs';
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Splits an array into smaller arrays of a specified length.
|
|
85
|
+
*
|
|
86
|
+
* This function takes an input array and divides it into multiple smaller arrays,
|
|
87
|
+
* each of a specified length. If the input array cannot be evenly divided,
|
|
88
|
+
* the final sub-array will contain the remaining elements.
|
|
89
|
+
*
|
|
90
|
+
* @template T The type of elements in the array.
|
|
91
|
+
* @param {T[]} arr - The array to be chunked into smaller arrays.
|
|
92
|
+
* @param {number} size - The size of each smaller array. Must be a positive integer.
|
|
93
|
+
* @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.
|
|
94
|
+
* @throws {Error} Throws an error if `size` is not a positive integer.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Splits an array of numbers into sub-arrays of length 2
|
|
98
|
+
* chunk([1, 2, 3, 4, 5], 2);
|
|
99
|
+
* // Returns: [[1, 2], [3, 4], [5]]
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* // Splits an array of strings into sub-arrays of length 3
|
|
103
|
+
* chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);
|
|
104
|
+
* // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]
|
|
105
|
+
*/
|
|
106
|
+
declare function chunk<T>(arr: readonly T[], size?: number): T[][];
|
|
107
|
+
|
|
108
|
+
export { chunk };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export { compact } from '../array/compact.js';
|
|
2
|
+
export { countBy } from '../array/countBy.js';
|
|
3
|
+
export { difference } from '../array/difference.js';
|
|
4
|
+
export { differenceBy } from '../array/differenceBy.js';
|
|
5
|
+
export { differenceWith } from '../array/differenceWith.js';
|
|
6
|
+
export { drop } from '../array/drop.js';
|
|
7
|
+
export { dropRight } from '../array/dropRight.js';
|
|
8
|
+
export { dropRightWhile } from '../array/dropRightWhile.js';
|
|
9
|
+
export { dropWhile } from '../array/dropWhile.js';
|
|
10
|
+
export { fill } from '../array/fill.js';
|
|
11
|
+
export { flatten } from '../array/flatten.js';
|
|
12
|
+
export { flattenDeep } from '../array/flattenDeep.js';
|
|
13
|
+
export { forEachRight } from '../array/forEachRight.js';
|
|
14
|
+
export { groupBy } from '../array/groupBy.js';
|
|
15
|
+
export { intersection } from '../array/intersection.js';
|
|
16
|
+
export { intersectionBy } from '../array/intersectionBy.js';
|
|
17
|
+
export { intersectionWith } from '../array/intersectionWith.js';
|
|
18
|
+
export { keyBy } from '../array/keyBy.js';
|
|
19
|
+
export { maxBy } from '../array/maxBy.js';
|
|
20
|
+
export { minBy } from '../array/minBy.js';
|
|
21
|
+
export { orderBy } from '../array/orderBy.js';
|
|
22
|
+
export { partition } from '../array/partition.js';
|
|
23
|
+
export { sample } from '../array/sample.js';
|
|
24
|
+
export { sampleSize } from '../array/sampleSize.js';
|
|
25
|
+
export { shuffle } from '../array/shuffle.js';
|
|
26
|
+
export { take } from '../array/take.js';
|
|
27
|
+
export { takeRight } from '../array/takeRight.js';
|
|
28
|
+
export { takeRightWhile } from '../array/takeRightWhile.js';
|
|
29
|
+
export { takeWhile } from '../array/takeWhile.js';
|
|
30
|
+
export { union } from '../array/union.js';
|
|
31
|
+
export { unionBy } from '../array/unionBy.js';
|
|
32
|
+
export { unionWith } from '../array/unionWith.js';
|
|
33
|
+
export { uniq } from '../array/uniq.js';
|
|
34
|
+
export { uniqBy } from '../array/uniqBy.js';
|
|
35
|
+
export { uniqWith } from '../array/uniqWith.js';
|
|
36
|
+
export { unzip } from '../array/unzip.js';
|
|
37
|
+
export { unzipWith } from '../array/unzipWith.js';
|
|
38
|
+
export { xor } from '../array/xor.js';
|
|
39
|
+
export { xorBy } from '../array/xorBy.js';
|
|
40
|
+
export { xorWith } from '../array/xorWith.js';
|
|
41
|
+
export { zip } from '../array/zip.js';
|
|
42
|
+
export { zipObject } from '../array/zipObject.js';
|
|
43
|
+
export { zipWith } from '../array/zipWith.js';
|
|
44
|
+
export { without } from '../array/without.js';
|
|
45
|
+
export { head } from '../array/head.js';
|
|
46
|
+
export { tail } from '../array/tail.js';
|
|
47
|
+
export { toFilled } from '../array/toFilled.js';
|
|
48
|
+
export { last } from '../array/last.js';
|
|
49
|
+
export { initial } from '../array/initial.js';
|
|
50
|
+
export { AbortError } from '../error/AbortError.js';
|
|
51
|
+
export { debounce } from '../function/debounce.js';
|
|
52
|
+
export { noop } from '../function/noop.js';
|
|
53
|
+
export { once } from '../function/once.js';
|
|
54
|
+
export { throttle } from '../function/throttle.js';
|
|
55
|
+
export { negate } from '../function/negate.js';
|
|
56
|
+
export { clamp } from '../math/clamp.js';
|
|
57
|
+
export { inRange } from '../math/inRange.js';
|
|
58
|
+
export { mean } from '../math/mean.js';
|
|
59
|
+
export { meanBy } from '../math/meanBy.js';
|
|
60
|
+
export { random } from '../math/random.js';
|
|
61
|
+
export { randomInt } from '../math/randomInt.js';
|
|
62
|
+
export { round } from '../math/round.js';
|
|
63
|
+
export { sum } from '../math/sum.js';
|
|
64
|
+
export { range } from '../math/range.js';
|
|
65
|
+
export { omit } from '../object/omit.js';
|
|
66
|
+
export { omitBy } from '../object/omitBy.js';
|
|
67
|
+
export { pick } from '../object/pick.js';
|
|
68
|
+
export { pickBy } from '../object/pickBy.js';
|
|
69
|
+
export { invert } from '../object/invert.js';
|
|
70
|
+
export { clone } from '../object/clone.js';
|
|
71
|
+
export { isEqual } from '../predicate/isEqual.js';
|
|
72
|
+
export { isNil } from '../predicate/isNil.js';
|
|
73
|
+
export { isNotNil } from '../predicate/isNotNil.js';
|
|
74
|
+
export { isNull } from '../predicate/isNull.js';
|
|
75
|
+
export { isUndefined } from '../predicate/isUndefined.js';
|
|
76
|
+
export { delay } from '../promise/delay.js';
|
|
77
|
+
export { camelCase } from '../string/camelCase.js';
|
|
78
|
+
export { snakeCase } from '../string/snakeCase.js';
|
|
79
|
+
export { kebabCase } from '../string/kebabCase.js';
|
|
80
|
+
export { lowerCase } from '../string/lowerCase.js';
|
|
81
|
+
export { capitalize } from '../string/capitalize.js';
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Splits an array into smaller arrays of a specified length.
|
|
85
|
+
*
|
|
86
|
+
* This function takes an input array and divides it into multiple smaller arrays,
|
|
87
|
+
* each of a specified length. If the input array cannot be evenly divided,
|
|
88
|
+
* the final sub-array will contain the remaining elements.
|
|
89
|
+
*
|
|
90
|
+
* @template T The type of elements in the array.
|
|
91
|
+
* @param {T[]} arr - The array to be chunked into smaller arrays.
|
|
92
|
+
* @param {number} size - The size of each smaller array. Must be a positive integer.
|
|
93
|
+
* @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.
|
|
94
|
+
* @throws {Error} Throws an error if `size` is not a positive integer.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Splits an array of numbers into sub-arrays of length 2
|
|
98
|
+
* chunk([1, 2, 3, 4, 5], 2);
|
|
99
|
+
* // Returns: [[1, 2], [3, 4], [5]]
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* // Splits an array of strings into sub-arrays of length 3
|
|
103
|
+
* chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);
|
|
104
|
+
* // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]
|
|
105
|
+
*/
|
|
106
|
+
declare function chunk<T>(arr: readonly T[], size?: number): T[][];
|
|
107
|
+
|
|
108
|
+
export { chunk };
|