es-toolkit 1.9.0-dev.176 → 1.9.0-dev.178
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/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/index.d.mts +1 -0
- package/dist/array/index.d.ts +1 -0
- package/dist/array/index.js +7 -0
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +22 -18
- package/dist/chunk-2SLTL4KL.mjs +13 -0
- package/dist/{chunk-NOFHNJ5C.mjs.map → chunk-2SLTL4KL.mjs.map} +1 -1
- package/dist/{chunk-LT6E4Y4Z.mjs → chunk-GDC64SYJ.mjs} +2 -2
- package/dist/chunk-HJPB4KC3.mjs +13 -0
- package/dist/chunk-HJPB4KC3.mjs.map +1 -0
- package/dist/{chunk-SDIMTYZW.mjs → chunk-IZAD2S7R.mjs} +2 -2
- package/dist/chunk-OJSIDS6H.mjs +1 -0
- package/dist/chunk-OJSIDS6H.mjs.map +1 -0
- package/dist/function/index.mjs +6 -6
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -38
- package/dist/math/index.js +2 -2
- package/dist/math/index.js.map +1 -1
- package/dist/math/index.mjs +5 -5
- package/dist/math/mean.js +2 -2
- package/dist/math/mean.js.map +1 -1
- package/dist/math/mean.mjs +2 -2
- package/dist/math/meanBy.js +2 -2
- package/dist/math/meanBy.js.map +1 -1
- package/dist/math/meanBy.mjs +3 -3
- package/dist/math/sum.js +2 -2
- package/dist/math/sum.js.map +1 -1
- package/dist/math/sum.mjs +1 -1
- package/dist/object/index.mjs +3 -3
- package/dist/predicate/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-NLN3GQ7D.mjs +0 -1
- package/dist/chunk-NOFHNJ5C.mjs +0 -13
- /package/dist/{chunk-NLN3GQ7D.mjs.map → array/flattenDeep.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
package/dist/array/index.mjs
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import "../chunk-
|
|
2
|
-
import {
|
|
3
|
-
zip
|
|
4
|
-
} from "../chunk-IDCUZVJL.mjs";
|
|
1
|
+
import "../chunk-OJSIDS6H.mjs";
|
|
5
2
|
import {
|
|
6
3
|
zipObject
|
|
7
4
|
} from "../chunk-6GWEY5EL.mjs";
|
|
8
5
|
import {
|
|
9
6
|
zipWith
|
|
10
7
|
} from "../chunk-4KYXHZ4R.mjs";
|
|
11
|
-
import {
|
|
12
|
-
uniqBy
|
|
13
|
-
} from "../chunk-OXAZEEGP.mjs";
|
|
14
8
|
import {
|
|
15
9
|
unzip
|
|
16
10
|
} from "../chunk-UYZKMBDO.mjs";
|
|
@@ -30,8 +24,8 @@ import {
|
|
|
30
24
|
xorWith
|
|
31
25
|
} from "../chunk-QRSJBBFY.mjs";
|
|
32
26
|
import {
|
|
33
|
-
|
|
34
|
-
} from "../chunk-
|
|
27
|
+
zip
|
|
28
|
+
} from "../chunk-IDCUZVJL.mjs";
|
|
35
29
|
import {
|
|
36
30
|
takeRightWhile
|
|
37
31
|
} from "../chunk-NTLX2MPV.mjs";
|
|
@@ -57,8 +51,8 @@ import {
|
|
|
57
51
|
uniq
|
|
58
52
|
} from "../chunk-DVK2N4KC.mjs";
|
|
59
53
|
import {
|
|
60
|
-
|
|
61
|
-
} from "../chunk-
|
|
54
|
+
uniqBy
|
|
55
|
+
} from "../chunk-OXAZEEGP.mjs";
|
|
62
56
|
import {
|
|
63
57
|
orderBy
|
|
64
58
|
} from "../chunk-7B7W36UP.mjs";
|
|
@@ -83,8 +77,8 @@ import {
|
|
|
83
77
|
take
|
|
84
78
|
} from "../chunk-ME352XO7.mjs";
|
|
85
79
|
import {
|
|
86
|
-
|
|
87
|
-
} from "../chunk-
|
|
80
|
+
takeRight
|
|
81
|
+
} from "../chunk-IQLKIDXF.mjs";
|
|
88
82
|
import {
|
|
89
83
|
intersection
|
|
90
84
|
} from "../chunk-FVVSE2F2.mjs";
|
|
@@ -104,11 +98,8 @@ import {
|
|
|
104
98
|
maxBy
|
|
105
99
|
} from "../chunk-OOKNBU4V.mjs";
|
|
106
100
|
import {
|
|
107
|
-
|
|
108
|
-
} from "../chunk-
|
|
109
|
-
import {
|
|
110
|
-
dropRight
|
|
111
|
-
} from "../chunk-JEKUA56R.mjs";
|
|
101
|
+
minBy
|
|
102
|
+
} from "../chunk-IJD7FE2Z.mjs";
|
|
112
103
|
import {
|
|
113
104
|
dropRightWhile
|
|
114
105
|
} from "../chunk-JE6JKZU3.mjs";
|
|
@@ -118,6 +109,9 @@ import {
|
|
|
118
109
|
import {
|
|
119
110
|
fill
|
|
120
111
|
} from "../chunk-C4WE4GLC.mjs";
|
|
112
|
+
import {
|
|
113
|
+
flattenDeep
|
|
114
|
+
} from "../chunk-HJPB4KC3.mjs";
|
|
121
115
|
import {
|
|
122
116
|
flatten
|
|
123
117
|
} from "../chunk-33MSBDC6.mjs";
|
|
@@ -127,6 +121,9 @@ import {
|
|
|
127
121
|
import {
|
|
128
122
|
groupBy
|
|
129
123
|
} from "../chunk-E6E4RZLN.mjs";
|
|
124
|
+
import {
|
|
125
|
+
head
|
|
126
|
+
} from "../chunk-HM2JT2RX.mjs";
|
|
130
127
|
import {
|
|
131
128
|
chunk
|
|
132
129
|
} from "../chunk-E6C5EZQA.mjs";
|
|
@@ -145,6 +142,12 @@ import {
|
|
|
145
142
|
import {
|
|
146
143
|
differenceWith
|
|
147
144
|
} from "../chunk-6NVQAHXP.mjs";
|
|
145
|
+
import {
|
|
146
|
+
drop
|
|
147
|
+
} from "../chunk-S3CORED5.mjs";
|
|
148
|
+
import {
|
|
149
|
+
dropRight
|
|
150
|
+
} from "../chunk-JEKUA56R.mjs";
|
|
148
151
|
import "../chunk-2MM5EJJX.mjs";
|
|
149
152
|
export {
|
|
150
153
|
chunk,
|
|
@@ -159,6 +162,7 @@ export {
|
|
|
159
162
|
dropWhile,
|
|
160
163
|
fill,
|
|
161
164
|
flatten,
|
|
165
|
+
flattenDeep,
|
|
162
166
|
forEachRight,
|
|
163
167
|
groupBy,
|
|
164
168
|
head,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/math/sum.ts"],"sourcesContent":["/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (
|
|
1
|
+
{"version":3,"sources":["../src/math/sum.ts"],"sourcesContent":["/**\n * Calculates the sum of an array of numbers.\n *\n * This function takes an array of numbers and returns the sum of all the elements in the array.\n *\n * @param {number[]} nums - An array of numbers to be summed.\n * @returns {number} The sum of all the numbers in the array.\n *\n * @example\n * const numbers = [1, 2, 3, 4, 5];\n * const result = sum(numbers);\n * // result will be 15\n */\nexport function sum(nums: readonly number[]): number {\n let result = 0;\n\n for (let i = 0; i < nums.length; i++) {\n result += nums[i];\n }\n\n return result;\n}\n"],"mappings":";AAaO,SAAS,IAAI,MAAiC;AACnD,MAAI,SAAS;AAEb,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,cAAU,KAAK,CAAC;AAAA,EAClB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sum
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2SLTL4KL.mjs";
|
|
4
4
|
|
|
5
5
|
// src/math/mean.ts
|
|
6
6
|
function mean(nums) {
|
|
@@ -10,4 +10,4 @@ function mean(nums) {
|
|
|
10
10
|
export {
|
|
11
11
|
mean
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-GDC64SYJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/array/flattenDeep.ts"],"sourcesContent":["import { flatten } from './flatten';\n\n/**\n * Utility type for recursively unpacking nested array types to extract the type of the innermost element\n *\n * @example\n * ExtractNestedArrayType<(number | (number | number[])[])[]>\n * // number\n *\n * ExtractNestedArrayType<(boolean | (string | number[])[])[]>\n * // string | number | boolean\n */\ntype ExtractNestedArrayType<T> = T extends ReadonlyArray<infer U> ? ExtractNestedArrayType<U> : T;\n\n/**\n * Flattens all depths of a nested array.\n *\n * @template T - The type of elements within the array.\n * @param {T[]} arr - The array to flatten.\n * @returns {Array<ExtractNestedArrayType<T>>} A new array that has been flattened.\n *\n * @example\n * const arr = flattenDeep([1, [2, [3]], [4, [5, 6]]]);\n * // Returns: [1, 2, 3, 4, 5, 6]\n */\nexport function flattenDeep<T>(arr: readonly T[]): Array<ExtractNestedArrayType<T>> {\n return flatten(arr, Infinity) as Array<ExtractNestedArrayType<T>>;\n}\n"],"mappings":";;;;;AAyBO,SAAS,YAAe,KAAqD;AAClF,SAAO,QAAQ,KAAK,QAAQ;AAC9B;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mean
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GDC64SYJ.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-
|
|
14
|
+
//# sourceMappingURL=chunk-IZAD2S7R.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-OJSIDS6H.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/function/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import "../chunk-N6EM6ETS.mjs";
|
|
2
|
-
import {
|
|
3
|
-
once
|
|
4
|
-
} from "../chunk-CMBC4MXG.mjs";
|
|
5
|
-
import {
|
|
6
|
-
throttle
|
|
7
|
-
} from "../chunk-QOJGMVVR.mjs";
|
|
8
2
|
import {
|
|
9
3
|
debounce
|
|
10
4
|
} from "../chunk-3IP4JVLL.mjs";
|
|
11
5
|
import {
|
|
12
6
|
noop
|
|
13
7
|
} from "../chunk-LKXCOLNY.mjs";
|
|
8
|
+
import {
|
|
9
|
+
once
|
|
10
|
+
} from "../chunk-CMBC4MXG.mjs";
|
|
11
|
+
import {
|
|
12
|
+
throttle
|
|
13
|
+
} from "../chunk-QOJGMVVR.mjs";
|
|
14
14
|
import "../chunk-2MM5EJJX.mjs";
|
|
15
15
|
export {
|
|
16
16
|
debounce,
|
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,7 @@ export { dropRightWhile } from './array/dropRightWhile.mjs';
|
|
|
10
10
|
export { dropWhile } from './array/dropWhile.mjs';
|
|
11
11
|
export { fill } from './array/fill.mjs';
|
|
12
12
|
export { flatten } from './array/flatten.mjs';
|
|
13
|
+
export { flattenDeep } from './array/flattenDeep.mjs';
|
|
13
14
|
export { forEachRight } from './array/forEachRight.mjs';
|
|
14
15
|
export { groupBy } from './array/groupBy.mjs';
|
|
15
16
|
export { intersection } from './array/intersection.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { dropRightWhile } from './array/dropRightWhile.js';
|
|
|
10
10
|
export { dropWhile } from './array/dropWhile.js';
|
|
11
11
|
export { fill } from './array/fill.js';
|
|
12
12
|
export { flatten } from './array/flatten.js';
|
|
13
|
+
export { flattenDeep } from './array/flattenDeep.js';
|
|
13
14
|
export { forEachRight } from './array/forEachRight.js';
|
|
14
15
|
export { groupBy } from './array/groupBy.js';
|
|
15
16
|
export { intersection } from './array/intersection.js';
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ __export(src_exports, {
|
|
|
50
50
|
dropWhile: () => dropWhile,
|
|
51
51
|
fill: () => fill,
|
|
52
52
|
flatten: () => flatten,
|
|
53
|
+
flattenDeep: () => flattenDeep,
|
|
53
54
|
forEachRight: () => forEachRight,
|
|
54
55
|
groupBy: () => groupBy,
|
|
55
56
|
head: () => head,
|
|
@@ -223,6 +224,11 @@ function flatten(arr, depth = 1) {
|
|
|
223
224
|
return result;
|
|
224
225
|
}
|
|
225
226
|
|
|
227
|
+
// src/array/flattenDeep.ts
|
|
228
|
+
function flattenDeep(arr) {
|
|
229
|
+
return flatten(arr, Infinity);
|
|
230
|
+
}
|
|
231
|
+
|
|
226
232
|
// src/array/forEachRight.ts
|
|
227
233
|
function forEachRight(arr, callback) {
|
|
228
234
|
for (let i = arr.length - 1; i >= 0; i--) {
|
|
@@ -700,8 +706,8 @@ function inRange(value, minimum, maximum) {
|
|
|
700
706
|
// src/math/sum.ts
|
|
701
707
|
function sum(nums) {
|
|
702
708
|
let result = 0;
|
|
703
|
-
for (
|
|
704
|
-
result +=
|
|
709
|
+
for (let i = 0; i < nums.length; i++) {
|
|
710
|
+
result += nums[i];
|
|
705
711
|
}
|
|
706
712
|
return result;
|
|
707
713
|
}
|
|
@@ -862,6 +868,7 @@ var snakeCase = (str) => {
|
|
|
862
868
|
dropWhile,
|
|
863
869
|
fill,
|
|
864
870
|
flatten,
|
|
871
|
+
flattenDeep,
|
|
865
872
|
forEachRight,
|
|
866
873
|
groupBy,
|
|
867
874
|
head,
|