es-toolkit 1.10.1-dev.218 → 1.10.1-dev.220

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,5 +1,11 @@
1
1
  import "../chunk-NKLIE2OI.mjs";
2
2
  import "../chunk-QKYYOLJ6.mjs";
3
+ import {
4
+ camelCase
5
+ } from "../chunk-Y5V7UAZZ.mjs";
6
+ import {
7
+ capitalize
8
+ } from "../chunk-U56ZOM7L.mjs";
3
9
  import {
4
10
  kebabCase
5
11
  } from "../chunk-EYYZQFOP.mjs";
@@ -9,17 +15,27 @@ import {
9
15
  import {
10
16
  snakeCase
11
17
  } from "../chunk-F3WCQQET.mjs";
18
+ import "../chunk-WVQ7YVRK.mjs";
19
+ import "../chunk-ASJF5D6C.mjs";
20
+ import {
21
+ isEqual
22
+ } from "../chunk-JYSV56US.mjs";
23
+ import {
24
+ isNil
25
+ } from "../chunk-WMM7TZLG.mjs";
26
+ import {
27
+ isNotNil
28
+ } from "../chunk-BMRTZMRE.mjs";
29
+ import {
30
+ isNull
31
+ } from "../chunk-AIRSKN47.mjs";
32
+ import {
33
+ isUndefined
34
+ } from "../chunk-VH2PV426.mjs";
12
35
  import "../chunk-ARZ5BDR6.mjs";
13
36
  import {
14
37
  delay
15
38
  } from "../chunk-O64NE2P4.mjs";
16
- import {
17
- camelCase
18
- } from "../chunk-Y5V7UAZZ.mjs";
19
- import {
20
- capitalize
21
- } from "../chunk-U56ZOM7L.mjs";
22
- import "../chunk-WVQ7YVRK.mjs";
23
39
  import "../chunk-OSOLEQLZ.mjs";
24
40
  import {
25
41
  clone
@@ -39,36 +55,10 @@ import {
39
55
  import {
40
56
  pickBy
41
57
  } from "../chunk-6CLH5YZ2.mjs";
42
- import "../chunk-ASJF5D6C.mjs";
43
- import {
44
- isEqual
45
- } from "../chunk-JYSV56US.mjs";
46
- import {
47
- isNil
48
- } from "../chunk-WMM7TZLG.mjs";
49
- import {
50
- isNotNil
51
- } from "../chunk-BMRTZMRE.mjs";
52
- import {
53
- isNull
54
- } from "../chunk-AIRSKN47.mjs";
55
- import {
56
- isUndefined
57
- } from "../chunk-VH2PV426.mjs";
58
- import "../chunk-236H5JZJ.mjs";
59
- import {
60
- negate
61
- } from "../chunk-BOOQBJN2.mjs";
62
- import {
63
- noop
64
- } from "../chunk-LKXCOLNY.mjs";
65
- import {
66
- once
67
- } from "../chunk-CMBC4MXG.mjs";
68
- import {
69
- throttle
70
- } from "../chunk-QOJGMVVR.mjs";
71
58
  import "../chunk-FUS75PJ7.mjs";
59
+ import {
60
+ sumBy
61
+ } from "../chunk-5L4VWRFX.mjs";
72
62
  import {
73
63
  meanBy
74
64
  } from "../chunk-IZAD2S7R.mjs";
@@ -81,9 +71,6 @@ import {
81
71
  import {
82
72
  round
83
73
  } from "../chunk-5PMKOZ2F.mjs";
84
- import {
85
- sumBy
86
- } from "../chunk-5L4VWRFX.mjs";
87
74
  import {
88
75
  sum
89
76
  } from "../chunk-2SLTL4KL.mjs";
@@ -93,14 +80,10 @@ import {
93
80
  import {
94
81
  inRange
95
82
  } from "../chunk-BH6HLGBA.mjs";
96
- import "../chunk-FZEZH22H.mjs";
83
+ import "../chunk-DDH7K4QM.mjs";
97
84
  import {
98
- AbortError
99
- } from "../chunk-DXB7EZUQ.mjs";
100
- import {
101
- debounce
102
- } from "../chunk-3IP4JVLL.mjs";
103
- import "../chunk-2MRZANXZ.mjs";
85
+ xor
86
+ } from "../chunk-L7FQX5MN.mjs";
104
87
  import {
105
88
  xorBy
106
89
  } from "../chunk-Q47NGNXT.mjs";
@@ -116,6 +99,9 @@ import {
116
99
  import {
117
100
  zipWith
118
101
  } from "../chunk-4KYXHZ4R.mjs";
102
+ import {
103
+ unionBy
104
+ } from "../chunk-NFS7RWWE.mjs";
119
105
  import {
120
106
  unionWith
121
107
  } from "../chunk-2ZCITDMK.mjs";
@@ -135,8 +121,8 @@ import {
135
121
  without
136
122
  } from "../chunk-PYEYV7BY.mjs";
137
123
  import {
138
- xor
139
- } from "../chunk-L7FQX5MN.mjs";
124
+ shuffle
125
+ } from "../chunk-G7UQ5PUR.mjs";
140
126
  import {
141
127
  tail
142
128
  } from "../chunk-OF6NM4G7.mjs";
@@ -162,8 +148,8 @@ import {
162
148
  uniq
163
149
  } from "../chunk-DVK2N4KC.mjs";
164
150
  import {
165
- unionBy
166
- } from "../chunk-NFS7RWWE.mjs";
151
+ keyBy
152
+ } from "../chunk-AJKZMN2V.mjs";
167
153
  import {
168
154
  last
169
155
  } from "../chunk-KPBQ7OUY.mjs";
@@ -192,8 +178,8 @@ import {
192
178
  random
193
179
  } from "../chunk-SYWMYQYJ.mjs";
194
180
  import {
195
- shuffle
196
- } from "../chunk-G7UQ5PUR.mjs";
181
+ forEachRight
182
+ } from "../chunk-IEA53J7P.mjs";
197
183
  import {
198
184
  groupBy
199
185
  } from "../chunk-E6E4RZLN.mjs";
@@ -212,9 +198,6 @@ import {
212
198
  import {
213
199
  intersectionWith
214
200
  } from "../chunk-XI7KRD2C.mjs";
215
- import {
216
- keyBy
217
- } from "../chunk-AJKZMN2V.mjs";
218
201
  import {
219
202
  drop
220
203
  } from "../chunk-S3CORED5.mjs";
@@ -230,15 +213,15 @@ import {
230
213
  import {
231
214
  fill
232
215
  } from "../chunk-6KP7CLVJ.mjs";
216
+ import {
217
+ flatMap
218
+ } from "../chunk-KBXHURLW.mjs";
233
219
  import {
234
220
  flattenDeep
235
221
  } from "../chunk-ML727RRJ.mjs";
236
222
  import {
237
223
  flatten
238
224
  } from "../chunk-33MSBDC6.mjs";
239
- import {
240
- forEachRight
241
- } from "../chunk-IEA53J7P.mjs";
242
225
  import {
243
226
  chunk
244
227
  } from "../chunk-E6C5EZQA.mjs";
@@ -257,6 +240,26 @@ import {
257
240
  import {
258
241
  differenceWith
259
242
  } from "../chunk-6NVQAHXP.mjs";
243
+ import "../chunk-FZEZH22H.mjs";
244
+ import {
245
+ AbortError
246
+ } from "../chunk-DXB7EZUQ.mjs";
247
+ import "../chunk-236H5JZJ.mjs";
248
+ import {
249
+ once
250
+ } from "../chunk-CMBC4MXG.mjs";
251
+ import {
252
+ throttle
253
+ } from "../chunk-QOJGMVVR.mjs";
254
+ import {
255
+ debounce
256
+ } from "../chunk-3IP4JVLL.mjs";
257
+ import {
258
+ negate
259
+ } from "../chunk-BOOQBJN2.mjs";
260
+ import {
261
+ noop
262
+ } from "../chunk-LKXCOLNY.mjs";
260
263
  import "../chunk-2MM5EJJX.mjs";
261
264
 
262
265
  // src/compat/array/chunk.ts
@@ -286,6 +289,7 @@ export {
286
289
  dropRightWhile,
287
290
  dropWhile,
288
291
  fill,
292
+ flatMap,
289
293
  flatten,
290
294
  flattenDeep,
291
295
  forEachRight,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/compat/array/chunk.ts"],"sourcesContent":["import { chunk as chunkToolkit } from '../../array/chunk.ts';\n\n/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: readonly T[], size: number = 1): T[][] {\n size = Math.max(Math.floor(size), 0);\n\n if (size === 0) {\n return [];\n }\n\n return chunkToolkit(arr, size);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,SAASA,OAAS,KAAmB,OAAe,GAAU;AACnE,SAAO,KAAK,IAAI,KAAK,MAAM,IAAI,GAAG,CAAC;AAEnC,MAAI,SAAS,GAAG;AACd,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,MAAa,KAAK,IAAI;AAC/B;","names":["chunk"]}
1
+ {"version":3,"sources":["../../src/compat/array/chunk.ts"],"sourcesContent":["import { chunk as chunkToolkit } from '../../array/chunk.ts';\n\n/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: readonly T[], size: number = 1): T[][] {\n size = Math.max(Math.floor(size), 0);\n\n if (size === 0) {\n return [];\n }\n\n return chunkToolkit(arr, size);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,SAASA,OAAS,KAAmB,OAAe,GAAU;AACnE,SAAO,KAAK,IAAI,KAAK,MAAM,IAAI,GAAG,CAAC;AAEnC,MAAI,SAAS,GAAG;AACd,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,MAAa,KAAK,IAAI;AAC/B;","names":["chunk"]}
@@ -1,10 +1,4 @@
1
1
  import "../chunk-236H5JZJ.mjs";
2
- import {
3
- negate
4
- } from "../chunk-BOOQBJN2.mjs";
5
- import {
6
- noop
7
- } from "../chunk-LKXCOLNY.mjs";
8
2
  import {
9
3
  once
10
4
  } from "../chunk-CMBC4MXG.mjs";
@@ -14,6 +8,12 @@ import {
14
8
  import {
15
9
  debounce
16
10
  } from "../chunk-3IP4JVLL.mjs";
11
+ import {
12
+ negate
13
+ } from "../chunk-BOOQBJN2.mjs";
14
+ import {
15
+ noop
16
+ } from "../chunk-LKXCOLNY.mjs";
17
17
  import "../chunk-2MM5EJJX.mjs";
18
18
  export {
19
19
  debounce,
package/dist/index.d.mts CHANGED
@@ -9,6 +9,7 @@ export { dropRight } from './array/dropRight.mjs';
9
9
  export { dropRightWhile } from './array/dropRightWhile.mjs';
10
10
  export { dropWhile } from './array/dropWhile.mjs';
11
11
  export { fill } from './array/fill.mjs';
12
+ export { flatMap } from './array/flatMap.mjs';
12
13
  export { flatten } from './array/flatten.mjs';
13
14
  export { flattenDeep } from './array/flattenDeep.mjs';
14
15
  export { forEachRight } from './array/forEachRight.mjs';
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { dropRight } from './array/dropRight.js';
9
9
  export { dropRightWhile } from './array/dropRightWhile.js';
10
10
  export { dropWhile } from './array/dropWhile.js';
11
11
  export { fill } from './array/fill.js';
12
+ export { flatMap } from './array/flatMap.js';
12
13
  export { flatten } from './array/flatten.js';
13
14
  export { flattenDeep } from './array/flattenDeep.js';
14
15
  export { forEachRight } from './array/forEachRight.js';
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ __export(src_exports, {
52
52
  dropRightWhile: () => dropRightWhile,
53
53
  dropWhile: () => dropWhile,
54
54
  fill: () => fill,
55
+ flatMap: () => flatMap,
55
56
  flatten: () => flatten,
56
57
  flattenDeep: () => flattenDeep,
57
58
  forEachRight: () => forEachRight,
@@ -233,6 +234,11 @@ function flatten(arr, depth = 1) {
233
234
  return result;
234
235
  }
235
236
 
237
+ // src/array/flatMap.ts
238
+ function flatMap(arr, iteratee, depth = 1) {
239
+ return flatten(arr.map((item) => iteratee(item)), depth);
240
+ }
241
+
236
242
  // src/array/flattenDeep.ts
237
243
  function flattenDeep(arr) {
238
244
  return flatten(arr, Infinity);
@@ -999,6 +1005,7 @@ var lowerCase = (str) => {
999
1005
  dropRightWhile,
1000
1006
  dropWhile,
1001
1007
  fill,
1008
+ flatMap,
1002
1009
  flatten,
1003
1010
  flattenDeep,
1004
1011
  forEachRight,