es-toolkit 1.9.0-dev.177 → 1.9.0-dev.179
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 +39 -35
- package/dist/chunk-HJPB4KC3.mjs +13 -0
- package/dist/chunk-HJPB4KC3.mjs.map +1 -0
- package/dist/chunk-MPBVTIU3.mjs +1 -0
- package/dist/chunk-OJSIDS6H.mjs +1 -0
- package/dist/chunk-OJSIDS6H.mjs.map +1 -0
- package/dist/chunk-U56ZOM7L.mjs +9 -0
- package/dist/chunk-U56ZOM7L.mjs.map +1 -0
- package/dist/function/index.mjs +3 -3
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -63
- package/dist/math/index.mjs +3 -3
- package/dist/object/index.mjs +3 -3
- package/dist/predicate/index.mjs +3 -3
- 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 +1 -0
- package/dist/string/index.d.ts +1 -0
- package/dist/string/index.js +7 -0
- package/dist/string/index.js.map +1 -1
- package/dist/string/index.mjs +5 -1
- package/package.json +1 -1
- package/dist/chunk-NLN3GQ7D.mjs +0 -1
- package/dist/chunk-YOFIBRET.mjs +0 -1
- /package/dist/{chunk-NLN3GQ7D.mjs.map → array/flattenDeep.mjs.map} +0 -0
- /package/dist/{chunk-YOFIBRET.mjs.map → chunk-MPBVTIU3.mjs.map} +0 -0
package/dist/array/index.mjs
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import "../chunk-
|
|
2
|
-
import {
|
|
3
|
-
xor
|
|
4
|
-
} from "../chunk-L7FQX5MN.mjs";
|
|
5
|
-
import {
|
|
6
|
-
xorBy
|
|
7
|
-
} from "../chunk-Q47NGNXT.mjs";
|
|
1
|
+
import "../chunk-OJSIDS6H.mjs";
|
|
8
2
|
import {
|
|
9
3
|
xorWith
|
|
10
4
|
} from "../chunk-QRSJBBFY.mjs";
|
|
@@ -17,18 +11,9 @@ import {
|
|
|
17
11
|
import {
|
|
18
12
|
zipWith
|
|
19
13
|
} from "../chunk-4KYXHZ4R.mjs";
|
|
20
|
-
import {
|
|
21
|
-
unionBy
|
|
22
|
-
} from "../chunk-NFS7RWWE.mjs";
|
|
23
|
-
import {
|
|
24
|
-
unionWith
|
|
25
|
-
} from "../chunk-2ZCITDMK.mjs";
|
|
26
14
|
import {
|
|
27
15
|
uniqBy
|
|
28
16
|
} from "../chunk-OXAZEEGP.mjs";
|
|
29
|
-
import {
|
|
30
|
-
uniqWith
|
|
31
|
-
} from "../chunk-237HGSZS.mjs";
|
|
32
17
|
import {
|
|
33
18
|
unzip
|
|
34
19
|
} from "../chunk-UYZKMBDO.mjs";
|
|
@@ -39,11 +24,11 @@ import {
|
|
|
39
24
|
without
|
|
40
25
|
} from "../chunk-PYEYV7BY.mjs";
|
|
41
26
|
import {
|
|
42
|
-
|
|
43
|
-
} from "../chunk-
|
|
27
|
+
xor
|
|
28
|
+
} from "../chunk-L7FQX5MN.mjs";
|
|
44
29
|
import {
|
|
45
|
-
|
|
46
|
-
} from "../chunk-
|
|
30
|
+
xorBy
|
|
31
|
+
} from "../chunk-Q47NGNXT.mjs";
|
|
47
32
|
import {
|
|
48
33
|
take
|
|
49
34
|
} from "../chunk-ME352XO7.mjs";
|
|
@@ -66,11 +51,14 @@ import {
|
|
|
66
51
|
uniq
|
|
67
52
|
} from "../chunk-DVK2N4KC.mjs";
|
|
68
53
|
import {
|
|
69
|
-
|
|
70
|
-
} from "../chunk-
|
|
54
|
+
unionBy
|
|
55
|
+
} from "../chunk-NFS7RWWE.mjs";
|
|
71
56
|
import {
|
|
72
|
-
|
|
73
|
-
} from "../chunk-
|
|
57
|
+
unionWith
|
|
58
|
+
} from "../chunk-2ZCITDMK.mjs";
|
|
59
|
+
import {
|
|
60
|
+
uniqWith
|
|
61
|
+
} from "../chunk-237HGSZS.mjs";
|
|
74
62
|
import {
|
|
75
63
|
maxBy
|
|
76
64
|
} from "../chunk-OOKNBU4V.mjs";
|
|
@@ -92,11 +80,11 @@ import {
|
|
|
92
80
|
import "../chunk-GIWAOOFY.mjs";
|
|
93
81
|
import "../chunk-SYWMYQYJ.mjs";
|
|
94
82
|
import {
|
|
95
|
-
|
|
96
|
-
} from "../chunk-
|
|
83
|
+
shuffle
|
|
84
|
+
} from "../chunk-G7UQ5PUR.mjs";
|
|
97
85
|
import {
|
|
98
|
-
|
|
99
|
-
} from "../chunk-
|
|
86
|
+
tail
|
|
87
|
+
} from "../chunk-OF6NM4G7.mjs";
|
|
100
88
|
import {
|
|
101
89
|
groupBy
|
|
102
90
|
} from "../chunk-E6E4RZLN.mjs";
|
|
@@ -113,14 +101,11 @@ import {
|
|
|
113
101
|
intersectionWith
|
|
114
102
|
} from "../chunk-XI7KRD2C.mjs";
|
|
115
103
|
import {
|
|
116
|
-
|
|
117
|
-
} from "../chunk-
|
|
118
|
-
import {
|
|
119
|
-
differenceBy
|
|
120
|
-
} from "../chunk-LVWX5B43.mjs";
|
|
104
|
+
keyBy
|
|
105
|
+
} from "../chunk-AJKZMN2V.mjs";
|
|
121
106
|
import {
|
|
122
|
-
|
|
123
|
-
} from "../chunk-
|
|
107
|
+
last
|
|
108
|
+
} from "../chunk-KPBQ7OUY.mjs";
|
|
124
109
|
import {
|
|
125
110
|
drop
|
|
126
111
|
} from "../chunk-S3CORED5.mjs";
|
|
@@ -136,6 +121,15 @@ import {
|
|
|
136
121
|
import {
|
|
137
122
|
fill
|
|
138
123
|
} from "../chunk-C4WE4GLC.mjs";
|
|
124
|
+
import {
|
|
125
|
+
flattenDeep
|
|
126
|
+
} from "../chunk-HJPB4KC3.mjs";
|
|
127
|
+
import {
|
|
128
|
+
flatten
|
|
129
|
+
} from "../chunk-33MSBDC6.mjs";
|
|
130
|
+
import {
|
|
131
|
+
forEachRight
|
|
132
|
+
} from "../chunk-IEA53J7P.mjs";
|
|
139
133
|
import {
|
|
140
134
|
chunk
|
|
141
135
|
} from "../chunk-E6C5EZQA.mjs";
|
|
@@ -145,6 +139,15 @@ import {
|
|
|
145
139
|
import {
|
|
146
140
|
countBy
|
|
147
141
|
} from "../chunk-CRSKT4WW.mjs";
|
|
142
|
+
import {
|
|
143
|
+
difference
|
|
144
|
+
} from "../chunk-JPUKH67K.mjs";
|
|
145
|
+
import {
|
|
146
|
+
differenceBy
|
|
147
|
+
} from "../chunk-LVWX5B43.mjs";
|
|
148
|
+
import {
|
|
149
|
+
differenceWith
|
|
150
|
+
} from "../chunk-6NVQAHXP.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,
|
|
@@ -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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-MPBVTIU3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-OJSIDS6H.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/string/capitalize.ts"],"sourcesContent":["/**\n * Converts the first character of string to upper case and the remaining to lower case.\n *\n * @template T - Literal type of the string.\n * @param {T} str - The string to be converted to uppercase.\n * @returns {Capitalize<T>} - The capitalized string.\n *\n * @example\n * const result = capitalize('fred') // returns 'Fred'\n * const result2 = capitalize('FRED') // returns 'Fred'\n */\n\nexport const capitalize = <T extends string>(str: T): Capitalize<T> => {\n return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()) as Capitalize<T>;\n};\n"],"mappings":";AAYO,IAAM,aAAa,CAAmB,QAA0B;AACrE,SAAQ,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC,EAAE,YAAY;AACjE;","names":[]}
|
package/dist/function/index.mjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import "../chunk-N6EM6ETS.mjs";
|
|
2
|
-
import {
|
|
3
|
-
noop
|
|
4
|
-
} from "../chunk-LKXCOLNY.mjs";
|
|
5
2
|
import {
|
|
6
3
|
once
|
|
7
4
|
} from "../chunk-CMBC4MXG.mjs";
|
|
@@ -11,6 +8,9 @@ import {
|
|
|
11
8
|
import {
|
|
12
9
|
debounce
|
|
13
10
|
} from "../chunk-3IP4JVLL.mjs";
|
|
11
|
+
import {
|
|
12
|
+
noop
|
|
13
|
+
} from "../chunk-LKXCOLNY.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';
|
|
@@ -71,3 +72,4 @@ export { isNull } from './predicate/isNull.mjs';
|
|
|
71
72
|
export { isUndefined } from './predicate/isUndefined.mjs';
|
|
72
73
|
export { delay } from './promise/delay.mjs';
|
|
73
74
|
export { snakeCase } from './string/snakeCase.mjs';
|
|
75
|
+
export { capitalize } from './string/capitalize.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';
|
|
@@ -71,3 +72,4 @@ export { isNull } from './predicate/isNull.js';
|
|
|
71
72
|
export { isUndefined } from './predicate/isUndefined.js';
|
|
72
73
|
export { delay } from './promise/delay.js';
|
|
73
74
|
export { snakeCase } from './string/snakeCase.js';
|
|
75
|
+
export { capitalize } from './string/capitalize.js';
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
35
35
|
var src_exports = {};
|
|
36
36
|
__export(src_exports, {
|
|
37
37
|
AbortError: () => AbortError,
|
|
38
|
+
capitalize: () => capitalize,
|
|
38
39
|
chunk: () => chunk,
|
|
39
40
|
clamp: () => clamp,
|
|
40
41
|
compact: () => compact,
|
|
@@ -50,6 +51,7 @@ __export(src_exports, {
|
|
|
50
51
|
dropWhile: () => dropWhile,
|
|
51
52
|
fill: () => fill,
|
|
52
53
|
flatten: () => flatten,
|
|
54
|
+
flattenDeep: () => flattenDeep,
|
|
53
55
|
forEachRight: () => forEachRight,
|
|
54
56
|
groupBy: () => groupBy,
|
|
55
57
|
head: () => head,
|
|
@@ -223,6 +225,11 @@ function flatten(arr, depth = 1) {
|
|
|
223
225
|
return result;
|
|
224
226
|
}
|
|
225
227
|
|
|
228
|
+
// src/array/flattenDeep.ts
|
|
229
|
+
function flattenDeep(arr) {
|
|
230
|
+
return flatten(arr, Infinity);
|
|
231
|
+
}
|
|
232
|
+
|
|
226
233
|
// src/array/forEachRight.ts
|
|
227
234
|
function forEachRight(arr, callback) {
|
|
228
235
|
for (let i = arr.length - 1; i >= 0; i--) {
|
|
@@ -844,9 +851,15 @@ var snakeCase = (str) => {
|
|
|
844
851
|
const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
|
|
845
852
|
return splitWords.map((word) => word.toLowerCase()).join("_");
|
|
846
853
|
};
|
|
854
|
+
|
|
855
|
+
// src/string/capitalize.ts
|
|
856
|
+
var capitalize = (str) => {
|
|
857
|
+
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
858
|
+
};
|
|
847
859
|
// Annotate the CommonJS export names for ESM import in node:
|
|
848
860
|
0 && (module.exports = {
|
|
849
861
|
AbortError,
|
|
862
|
+
capitalize,
|
|
850
863
|
chunk,
|
|
851
864
|
clamp,
|
|
852
865
|
compact,
|
|
@@ -862,6 +875,7 @@ var snakeCase = (str) => {
|
|
|
862
875
|
dropWhile,
|
|
863
876
|
fill,
|
|
864
877
|
flatten,
|
|
878
|
+
flattenDeep,
|
|
865
879
|
forEachRight,
|
|
866
880
|
groupBy,
|
|
867
881
|
head,
|