es-toolkit 1.10.0-dev.202 → 1.10.0-dev.205
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/dist/array/index.mjs +50 -50
- package/dist/chunk-NKLIE2OI.mjs +1 -0
- package/dist/chunk-NKLIE2OI.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/function/index.mjs +6 -6
- package/dist/index.mjs +99 -98
- package/dist/math/index.mjs +6 -6
- package/dist/predicate/index.mjs +3 -3
- package/package.json +1 -1
package/dist/array/index.mjs
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import "../chunk-2MRZANXZ.mjs";
|
|
2
|
+
import {
|
|
3
|
+
without
|
|
4
|
+
} from "../chunk-PYEYV7BY.mjs";
|
|
5
|
+
import {
|
|
6
|
+
xor
|
|
7
|
+
} from "../chunk-L7FQX5MN.mjs";
|
|
8
|
+
import {
|
|
9
|
+
xorBy
|
|
10
|
+
} from "../chunk-Q47NGNXT.mjs";
|
|
2
11
|
import {
|
|
3
12
|
xorWith
|
|
4
13
|
} from "../chunk-QRSJBBFY.mjs";
|
|
@@ -11,9 +20,24 @@ import {
|
|
|
11
20
|
import {
|
|
12
21
|
zipWith
|
|
13
22
|
} from "../chunk-4KYXHZ4R.mjs";
|
|
23
|
+
import {
|
|
24
|
+
union
|
|
25
|
+
} from "../chunk-R6QA7PLZ.mjs";
|
|
26
|
+
import {
|
|
27
|
+
unionBy
|
|
28
|
+
} from "../chunk-NFS7RWWE.mjs";
|
|
29
|
+
import {
|
|
30
|
+
unionWith
|
|
31
|
+
} from "../chunk-2ZCITDMK.mjs";
|
|
32
|
+
import {
|
|
33
|
+
uniq
|
|
34
|
+
} from "../chunk-DVK2N4KC.mjs";
|
|
14
35
|
import {
|
|
15
36
|
uniqBy
|
|
16
37
|
} from "../chunk-OXAZEEGP.mjs";
|
|
38
|
+
import {
|
|
39
|
+
uniqWith
|
|
40
|
+
} from "../chunk-237HGSZS.mjs";
|
|
17
41
|
import {
|
|
18
42
|
unzip
|
|
19
43
|
} from "../chunk-UYZKMBDO.mjs";
|
|
@@ -21,14 +45,16 @@ import {
|
|
|
21
45
|
unzipWith
|
|
22
46
|
} from "../chunk-IFNXROZR.mjs";
|
|
23
47
|
import {
|
|
24
|
-
|
|
25
|
-
} from "../chunk-
|
|
48
|
+
sampleSize
|
|
49
|
+
} from "../chunk-EHSKB6DF.mjs";
|
|
50
|
+
import "../chunk-GIWAOOFY.mjs";
|
|
51
|
+
import "../chunk-SYWMYQYJ.mjs";
|
|
26
52
|
import {
|
|
27
|
-
|
|
28
|
-
} from "../chunk-
|
|
53
|
+
shuffle
|
|
54
|
+
} from "../chunk-G7UQ5PUR.mjs";
|
|
29
55
|
import {
|
|
30
|
-
|
|
31
|
-
} from "../chunk-
|
|
56
|
+
tail
|
|
57
|
+
} from "../chunk-OF6NM4G7.mjs";
|
|
32
58
|
import {
|
|
33
59
|
take
|
|
34
60
|
} from "../chunk-ME352XO7.mjs";
|
|
@@ -45,20 +71,14 @@ import {
|
|
|
45
71
|
toFilled
|
|
46
72
|
} from "../chunk-OP4OAKQJ.mjs";
|
|
47
73
|
import {
|
|
48
|
-
|
|
49
|
-
} from "../chunk-
|
|
50
|
-
import {
|
|
51
|
-
uniq
|
|
52
|
-
} from "../chunk-DVK2N4KC.mjs";
|
|
53
|
-
import {
|
|
54
|
-
unionBy
|
|
55
|
-
} from "../chunk-NFS7RWWE.mjs";
|
|
74
|
+
intersectionWith
|
|
75
|
+
} from "../chunk-XI7KRD2C.mjs";
|
|
56
76
|
import {
|
|
57
|
-
|
|
58
|
-
} from "../chunk-
|
|
77
|
+
keyBy
|
|
78
|
+
} from "../chunk-AJKZMN2V.mjs";
|
|
59
79
|
import {
|
|
60
|
-
|
|
61
|
-
} from "../chunk-
|
|
80
|
+
last
|
|
81
|
+
} from "../chunk-KPBQ7OUY.mjs";
|
|
62
82
|
import {
|
|
63
83
|
maxBy
|
|
64
84
|
} from "../chunk-OOKNBU4V.mjs";
|
|
@@ -75,16 +95,14 @@ import {
|
|
|
75
95
|
sample
|
|
76
96
|
} from "../chunk-2KNLZB7V.mjs";
|
|
77
97
|
import {
|
|
78
|
-
|
|
79
|
-
} from "../chunk-
|
|
80
|
-
import "../chunk-GIWAOOFY.mjs";
|
|
81
|
-
import "../chunk-SYWMYQYJ.mjs";
|
|
98
|
+
flattenDeep
|
|
99
|
+
} from "../chunk-ML727RRJ.mjs";
|
|
82
100
|
import {
|
|
83
|
-
|
|
84
|
-
} from "../chunk-
|
|
101
|
+
forEachRight
|
|
102
|
+
} from "../chunk-IEA53J7P.mjs";
|
|
85
103
|
import {
|
|
86
|
-
|
|
87
|
-
} from "../chunk-
|
|
104
|
+
groupBy
|
|
105
|
+
} from "../chunk-E6E4RZLN.mjs";
|
|
88
106
|
import {
|
|
89
107
|
head
|
|
90
108
|
} from "../chunk-HM2JT2RX.mjs";
|
|
@@ -98,14 +116,14 @@ import {
|
|
|
98
116
|
intersectionBy
|
|
99
117
|
} from "../chunk-O6UXZR3U.mjs";
|
|
100
118
|
import {
|
|
101
|
-
|
|
102
|
-
} from "../chunk-
|
|
119
|
+
differenceBy
|
|
120
|
+
} from "../chunk-LVWX5B43.mjs";
|
|
103
121
|
import {
|
|
104
|
-
|
|
105
|
-
} from "../chunk-
|
|
122
|
+
differenceWith
|
|
123
|
+
} from "../chunk-6NVQAHXP.mjs";
|
|
106
124
|
import {
|
|
107
|
-
|
|
108
|
-
} from "../chunk-
|
|
125
|
+
drop
|
|
126
|
+
} from "../chunk-S3CORED5.mjs";
|
|
109
127
|
import {
|
|
110
128
|
dropRight
|
|
111
129
|
} from "../chunk-JEKUA56R.mjs";
|
|
@@ -118,18 +136,9 @@ import {
|
|
|
118
136
|
import {
|
|
119
137
|
fill
|
|
120
138
|
} from "../chunk-C4WE4GLC.mjs";
|
|
121
|
-
import {
|
|
122
|
-
flattenDeep
|
|
123
|
-
} from "../chunk-ML727RRJ.mjs";
|
|
124
139
|
import {
|
|
125
140
|
flatten
|
|
126
141
|
} from "../chunk-33MSBDC6.mjs";
|
|
127
|
-
import {
|
|
128
|
-
forEachRight
|
|
129
|
-
} from "../chunk-IEA53J7P.mjs";
|
|
130
|
-
import {
|
|
131
|
-
groupBy
|
|
132
|
-
} from "../chunk-E6E4RZLN.mjs";
|
|
133
142
|
import {
|
|
134
143
|
chunk
|
|
135
144
|
} from "../chunk-E6C5EZQA.mjs";
|
|
@@ -142,15 +151,6 @@ import {
|
|
|
142
151
|
import {
|
|
143
152
|
difference
|
|
144
153
|
} from "../chunk-JPUKH67K.mjs";
|
|
145
|
-
import {
|
|
146
|
-
differenceBy
|
|
147
|
-
} from "../chunk-LVWX5B43.mjs";
|
|
148
|
-
import {
|
|
149
|
-
differenceWith
|
|
150
|
-
} from "../chunk-6NVQAHXP.mjs";
|
|
151
|
-
import {
|
|
152
|
-
drop
|
|
153
|
-
} from "../chunk-S3CORED5.mjs";
|
|
154
154
|
import "../chunk-2HIMLZE3.mjs";
|
|
155
155
|
export {
|
|
156
156
|
chunk,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-NKLIE2OI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","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 };
|