es-toolkit 1.9.0-dev.177 → 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.
@@ -1,4 +1,19 @@
1
- import "../chunk-NLN3GQ7D.mjs";
1
+ import "../chunk-OJSIDS6H.mjs";
2
+ import {
3
+ zipObject
4
+ } from "../chunk-6GWEY5EL.mjs";
5
+ import {
6
+ zipWith
7
+ } from "../chunk-4KYXHZ4R.mjs";
8
+ import {
9
+ unzip
10
+ } from "../chunk-UYZKMBDO.mjs";
11
+ import {
12
+ unzipWith
13
+ } from "../chunk-IFNXROZR.mjs";
14
+ import {
15
+ without
16
+ } from "../chunk-PYEYV7BY.mjs";
2
17
  import {
3
18
  xor
4
19
  } from "../chunk-L7FQX5MN.mjs";
@@ -12,32 +27,46 @@ import {
12
27
  zip
13
28
  } from "../chunk-IDCUZVJL.mjs";
14
29
  import {
15
- zipObject
16
- } from "../chunk-6GWEY5EL.mjs";
30
+ takeRightWhile
31
+ } from "../chunk-NTLX2MPV.mjs";
17
32
  import {
18
- zipWith
19
- } from "../chunk-4KYXHZ4R.mjs";
33
+ takeWhile
34
+ } from "../chunk-2IXFGSUA.mjs";
35
+ import {
36
+ toFilled
37
+ } from "../chunk-OP4OAKQJ.mjs";
38
+ import {
39
+ union
40
+ } from "../chunk-R6QA7PLZ.mjs";
20
41
  import {
21
42
  unionBy
22
43
  } from "../chunk-NFS7RWWE.mjs";
23
44
  import {
24
45
  unionWith
25
46
  } from "../chunk-2ZCITDMK.mjs";
47
+ import {
48
+ uniqWith
49
+ } from "../chunk-237HGSZS.mjs";
50
+ import {
51
+ uniq
52
+ } from "../chunk-DVK2N4KC.mjs";
26
53
  import {
27
54
  uniqBy
28
55
  } from "../chunk-OXAZEEGP.mjs";
29
56
  import {
30
- uniqWith
31
- } from "../chunk-237HGSZS.mjs";
57
+ orderBy
58
+ } from "../chunk-7B7W36UP.mjs";
32
59
  import {
33
- unzip
34
- } from "../chunk-UYZKMBDO.mjs";
60
+ partition
61
+ } from "../chunk-DN3NOZ3H.mjs";
35
62
  import {
36
- unzipWith
37
- } from "../chunk-IFNXROZR.mjs";
63
+ sample
64
+ } from "../chunk-2KNLZB7V.mjs";
38
65
  import {
39
- without
40
- } from "../chunk-PYEYV7BY.mjs";
66
+ sampleSize
67
+ } from "../chunk-EHSKB6DF.mjs";
68
+ import "../chunk-GIWAOOFY.mjs";
69
+ import "../chunk-SYWMYQYJ.mjs";
41
70
  import {
42
71
  shuffle
43
72
  } from "../chunk-G7UQ5PUR.mjs";
@@ -51,20 +80,14 @@ import {
51
80
  takeRight
52
81
  } from "../chunk-IQLKIDXF.mjs";
53
82
  import {
54
- takeRightWhile
55
- } from "../chunk-NTLX2MPV.mjs";
56
- import {
57
- takeWhile
58
- } from "../chunk-2IXFGSUA.mjs";
59
- import {
60
- toFilled
61
- } from "../chunk-OP4OAKQJ.mjs";
83
+ intersection
84
+ } from "../chunk-FVVSE2F2.mjs";
62
85
  import {
63
- union
64
- } from "../chunk-R6QA7PLZ.mjs";
86
+ intersectionBy
87
+ } from "../chunk-O6UXZR3U.mjs";
65
88
  import {
66
- uniq
67
- } from "../chunk-DVK2N4KC.mjs";
89
+ intersectionWith
90
+ } from "../chunk-XI7KRD2C.mjs";
68
91
  import {
69
92
  keyBy
70
93
  } from "../chunk-AJKZMN2V.mjs";
@@ -78,19 +101,17 @@ import {
78
101
  minBy
79
102
  } from "../chunk-IJD7FE2Z.mjs";
80
103
  import {
81
- orderBy
82
- } from "../chunk-7B7W36UP.mjs";
104
+ dropRightWhile
105
+ } from "../chunk-JE6JKZU3.mjs";
83
106
  import {
84
- partition
85
- } from "../chunk-DN3NOZ3H.mjs";
107
+ dropWhile
108
+ } from "../chunk-LJ2C6MVP.mjs";
86
109
  import {
87
- sample
88
- } from "../chunk-2KNLZB7V.mjs";
110
+ fill
111
+ } from "../chunk-C4WE4GLC.mjs";
89
112
  import {
90
- sampleSize
91
- } from "../chunk-EHSKB6DF.mjs";
92
- import "../chunk-GIWAOOFY.mjs";
93
- import "../chunk-SYWMYQYJ.mjs";
113
+ flattenDeep
114
+ } from "../chunk-HJPB4KC3.mjs";
94
115
  import {
95
116
  flatten
96
117
  } from "../chunk-33MSBDC6.mjs";
@@ -104,14 +125,14 @@ import {
104
125
  head
105
126
  } from "../chunk-HM2JT2RX.mjs";
106
127
  import {
107
- intersection
108
- } from "../chunk-FVVSE2F2.mjs";
128
+ chunk
129
+ } from "../chunk-E6C5EZQA.mjs";
109
130
  import {
110
- intersectionBy
111
- } from "../chunk-O6UXZR3U.mjs";
131
+ compact
132
+ } from "../chunk-DTJJIMKJ.mjs";
112
133
  import {
113
- intersectionWith
114
- } from "../chunk-XI7KRD2C.mjs";
134
+ countBy
135
+ } from "../chunk-CRSKT4WW.mjs";
115
136
  import {
116
137
  difference
117
138
  } from "../chunk-JPUKH67K.mjs";
@@ -127,24 +148,6 @@ import {
127
148
  import {
128
149
  dropRight
129
150
  } from "../chunk-JEKUA56R.mjs";
130
- import {
131
- dropRightWhile
132
- } from "../chunk-JE6JKZU3.mjs";
133
- import {
134
- dropWhile
135
- } from "../chunk-LJ2C6MVP.mjs";
136
- import {
137
- fill
138
- } from "../chunk-C4WE4GLC.mjs";
139
- import {
140
- chunk
141
- } from "../chunk-E6C5EZQA.mjs";
142
- import {
143
- compact
144
- } from "../chunk-DTJJIMKJ.mjs";
145
- import {
146
- countBy
147
- } from "../chunk-CRSKT4WW.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,13 @@
1
+ import {
2
+ flatten
3
+ } from "./chunk-33MSBDC6.mjs";
4
+
5
+ // src/array/flattenDeep.ts
6
+ function flattenDeep(arr) {
7
+ return flatten(arr, Infinity);
8
+ }
9
+
10
+ export {
11
+ flattenDeep
12
+ };
13
+ //# sourceMappingURL=chunk-HJPB4KC3.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":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-OJSIDS6H.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,7 @@
1
1
  import "../chunk-N6EM6ETS.mjs";
2
+ import {
3
+ debounce
4
+ } from "../chunk-3IP4JVLL.mjs";
2
5
  import {
3
6
  noop
4
7
  } from "../chunk-LKXCOLNY.mjs";
@@ -8,9 +11,6 @@ import {
8
11
  import {
9
12
  throttle
10
13
  } from "../chunk-QOJGMVVR.mjs";
11
- import {
12
- debounce
13
- } from "../chunk-3IP4JVLL.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--) {
@@ -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,