es-toolkit 1.10.1-dev.229 → 1.10.1-dev.230
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 +31 -31
- package/dist/chunk-MJA7DAOJ.mjs +25 -0
- package/dist/chunk-MJA7DAOJ.mjs.map +1 -0
- package/dist/chunk-XT74R35S.mjs +1 -0
- package/dist/compat/index.d.mts +1 -0
- package/dist/compat/index.d.ts +1 -0
- package/dist/compat/index.js +19 -0
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +60 -56
- package/dist/compat/index.mjs.map +1 -1
- 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 +19 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -56
- package/dist/string/index.d.mts +1 -0
- package/dist/string/index.d.ts +1 -0
- package/dist/string/index.js +21 -2
- package/dist/string/index.js.map +1 -1
- package/dist/string/index.mjs +6 -2
- package/dist/string/startCase.d.mts +16 -0
- package/dist/string/startCase.d.ts +16 -0
- package/dist/string/startCase.js +54 -0
- package/dist/string/startCase.js.map +1 -0
- package/dist/string/startCase.mjs +9 -0
- package/dist/string/startCase.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-QKYYOLJ6.mjs +0 -1
- /package/dist/{chunk-QKYYOLJ6.mjs.map → chunk-XT74R35S.mjs.map} +0 -0
package/dist/compat/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../chunk-NKLIE2OI.mjs";
|
|
2
|
-
import "../chunk-
|
|
2
|
+
import "../chunk-XT74R35S.mjs";
|
|
3
3
|
import {
|
|
4
4
|
camelCase
|
|
5
5
|
} from "../chunk-Y5V7UAZZ.mjs";
|
|
@@ -15,6 +15,9 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
snakeCase
|
|
17
17
|
} from "../chunk-F3WCQQET.mjs";
|
|
18
|
+
import {
|
|
19
|
+
startCase
|
|
20
|
+
} from "../chunk-MJA7DAOJ.mjs";
|
|
18
21
|
import "../chunk-WVQ7YVRK.mjs";
|
|
19
22
|
import "../chunk-ASJF5D6C.mjs";
|
|
20
23
|
import {
|
|
@@ -74,22 +77,6 @@ import {
|
|
|
74
77
|
import {
|
|
75
78
|
sum
|
|
76
79
|
} from "../chunk-2SLTL4KL.mjs";
|
|
77
|
-
import "../chunk-236H5JZJ.mjs";
|
|
78
|
-
import {
|
|
79
|
-
debounce
|
|
80
|
-
} from "../chunk-3IP4JVLL.mjs";
|
|
81
|
-
import {
|
|
82
|
-
negate
|
|
83
|
-
} from "../chunk-BOOQBJN2.mjs";
|
|
84
|
-
import {
|
|
85
|
-
noop
|
|
86
|
-
} from "../chunk-LKXCOLNY.mjs";
|
|
87
|
-
import {
|
|
88
|
-
once
|
|
89
|
-
} from "../chunk-CMBC4MXG.mjs";
|
|
90
|
-
import {
|
|
91
|
-
throttle
|
|
92
|
-
} from "../chunk-QOJGMVVR.mjs";
|
|
93
80
|
import {
|
|
94
81
|
clamp
|
|
95
82
|
} from "../chunk-MLCL773E.mjs";
|
|
@@ -97,12 +84,6 @@ import {
|
|
|
97
84
|
inRange
|
|
98
85
|
} from "../chunk-BH6HLGBA.mjs";
|
|
99
86
|
import "../chunk-DDH7K4QM.mjs";
|
|
100
|
-
import {
|
|
101
|
-
unzipWith
|
|
102
|
-
} from "../chunk-IFNXROZR.mjs";
|
|
103
|
-
import {
|
|
104
|
-
without
|
|
105
|
-
} from "../chunk-PYEYV7BY.mjs";
|
|
106
87
|
import {
|
|
107
88
|
xor
|
|
108
89
|
} from "../chunk-L7FQX5MN.mjs";
|
|
@@ -121,21 +102,12 @@ import {
|
|
|
121
102
|
import {
|
|
122
103
|
zipWith
|
|
123
104
|
} from "../chunk-4KYXHZ4R.mjs";
|
|
124
|
-
import {
|
|
125
|
-
toFilled
|
|
126
|
-
} from "../chunk-OP4OAKQJ.mjs";
|
|
127
|
-
import {
|
|
128
|
-
union
|
|
129
|
-
} from "../chunk-R6QA7PLZ.mjs";
|
|
130
105
|
import {
|
|
131
106
|
unionBy
|
|
132
107
|
} from "../chunk-NFS7RWWE.mjs";
|
|
133
108
|
import {
|
|
134
109
|
unionWith
|
|
135
110
|
} from "../chunk-2ZCITDMK.mjs";
|
|
136
|
-
import {
|
|
137
|
-
uniq
|
|
138
|
-
} from "../chunk-DVK2N4KC.mjs";
|
|
139
111
|
import {
|
|
140
112
|
uniqBy
|
|
141
113
|
} from "../chunk-OXAZEEGP.mjs";
|
|
@@ -146,17 +118,11 @@ import {
|
|
|
146
118
|
unzip
|
|
147
119
|
} from "../chunk-UYZKMBDO.mjs";
|
|
148
120
|
import {
|
|
149
|
-
|
|
150
|
-
} from "../chunk-
|
|
151
|
-
import {
|
|
152
|
-
sampleSize
|
|
153
|
-
} from "../chunk-EHSKB6DF.mjs";
|
|
154
|
-
import {
|
|
155
|
-
randomInt
|
|
156
|
-
} from "../chunk-GIWAOOFY.mjs";
|
|
121
|
+
unzipWith
|
|
122
|
+
} from "../chunk-IFNXROZR.mjs";
|
|
157
123
|
import {
|
|
158
|
-
|
|
159
|
-
} from "../chunk-
|
|
124
|
+
without
|
|
125
|
+
} from "../chunk-PYEYV7BY.mjs";
|
|
160
126
|
import {
|
|
161
127
|
shuffle
|
|
162
128
|
} from "../chunk-G7UQ5PUR.mjs";
|
|
@@ -176,11 +142,14 @@ import {
|
|
|
176
142
|
takeWhile
|
|
177
143
|
} from "../chunk-2IXFGSUA.mjs";
|
|
178
144
|
import {
|
|
179
|
-
|
|
180
|
-
} from "../chunk-
|
|
145
|
+
toFilled
|
|
146
|
+
} from "../chunk-OP4OAKQJ.mjs";
|
|
181
147
|
import {
|
|
182
|
-
|
|
183
|
-
} from "../chunk-
|
|
148
|
+
union
|
|
149
|
+
} from "../chunk-R6QA7PLZ.mjs";
|
|
150
|
+
import {
|
|
151
|
+
uniq
|
|
152
|
+
} from "../chunk-DVK2N4KC.mjs";
|
|
184
153
|
import {
|
|
185
154
|
keyBy
|
|
186
155
|
} from "../chunk-AJKZMN2V.mjs";
|
|
@@ -200,8 +169,17 @@ import {
|
|
|
200
169
|
partition
|
|
201
170
|
} from "../chunk-DN3NOZ3H.mjs";
|
|
202
171
|
import {
|
|
203
|
-
|
|
204
|
-
} from "../chunk-
|
|
172
|
+
sample
|
|
173
|
+
} from "../chunk-2KNLZB7V.mjs";
|
|
174
|
+
import {
|
|
175
|
+
sampleSize
|
|
176
|
+
} from "../chunk-EHSKB6DF.mjs";
|
|
177
|
+
import {
|
|
178
|
+
randomInt
|
|
179
|
+
} from "../chunk-GIWAOOFY.mjs";
|
|
180
|
+
import {
|
|
181
|
+
random
|
|
182
|
+
} from "../chunk-SYWMYQYJ.mjs";
|
|
205
183
|
import {
|
|
206
184
|
forEachRight
|
|
207
185
|
} from "../chunk-IEA53J7P.mjs";
|
|
@@ -218,11 +196,11 @@ import {
|
|
|
218
196
|
intersection
|
|
219
197
|
} from "../chunk-FVVSE2F2.mjs";
|
|
220
198
|
import {
|
|
221
|
-
|
|
222
|
-
} from "../chunk-
|
|
199
|
+
intersectionBy
|
|
200
|
+
} from "../chunk-O6UXZR3U.mjs";
|
|
223
201
|
import {
|
|
224
|
-
|
|
225
|
-
} from "../chunk-
|
|
202
|
+
intersectionWith
|
|
203
|
+
} from "../chunk-XI7KRD2C.mjs";
|
|
226
204
|
import {
|
|
227
205
|
drop
|
|
228
206
|
} from "../chunk-S3CORED5.mjs";
|
|
@@ -241,13 +219,12 @@ import {
|
|
|
241
219
|
import {
|
|
242
220
|
flatMap
|
|
243
221
|
} from "../chunk-KBXHURLW.mjs";
|
|
222
|
+
import {
|
|
223
|
+
flattenDeep
|
|
224
|
+
} from "../chunk-ML727RRJ.mjs";
|
|
244
225
|
import {
|
|
245
226
|
flatten
|
|
246
227
|
} from "../chunk-33MSBDC6.mjs";
|
|
247
|
-
import "../chunk-FZEZH22H.mjs";
|
|
248
|
-
import {
|
|
249
|
-
AbortError
|
|
250
|
-
} from "../chunk-DXB7EZUQ.mjs";
|
|
251
228
|
import {
|
|
252
229
|
chunk
|
|
253
230
|
} from "../chunk-E6C5EZQA.mjs";
|
|
@@ -260,6 +237,32 @@ import {
|
|
|
260
237
|
import {
|
|
261
238
|
difference
|
|
262
239
|
} from "../chunk-JPUKH67K.mjs";
|
|
240
|
+
import {
|
|
241
|
+
differenceBy
|
|
242
|
+
} from "../chunk-LVWX5B43.mjs";
|
|
243
|
+
import {
|
|
244
|
+
differenceWith
|
|
245
|
+
} from "../chunk-6NVQAHXP.mjs";
|
|
246
|
+
import "../chunk-FZEZH22H.mjs";
|
|
247
|
+
import {
|
|
248
|
+
AbortError
|
|
249
|
+
} from "../chunk-DXB7EZUQ.mjs";
|
|
250
|
+
import "../chunk-236H5JZJ.mjs";
|
|
251
|
+
import {
|
|
252
|
+
once
|
|
253
|
+
} from "../chunk-CMBC4MXG.mjs";
|
|
254
|
+
import {
|
|
255
|
+
throttle
|
|
256
|
+
} from "../chunk-QOJGMVVR.mjs";
|
|
257
|
+
import {
|
|
258
|
+
debounce
|
|
259
|
+
} from "../chunk-3IP4JVLL.mjs";
|
|
260
|
+
import {
|
|
261
|
+
negate
|
|
262
|
+
} from "../chunk-BOOQBJN2.mjs";
|
|
263
|
+
import {
|
|
264
|
+
noop
|
|
265
|
+
} from "../chunk-LKXCOLNY.mjs";
|
|
263
266
|
import "../chunk-2MM5EJJX.mjs";
|
|
264
267
|
|
|
265
268
|
// src/compat/array/chunk.ts
|
|
@@ -331,6 +334,7 @@ export {
|
|
|
331
334
|
sampleSize,
|
|
332
335
|
shuffle,
|
|
333
336
|
snakeCase,
|
|
337
|
+
startCase,
|
|
334
338
|
sum,
|
|
335
339
|
sumBy,
|
|
336
340
|
tail,
|
|
@@ -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":"
|
|
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"]}
|
package/dist/function/index.mjs
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import "../chunk-236H5JZJ.mjs";
|
|
2
|
+
import {
|
|
3
|
+
once
|
|
4
|
+
} from "../chunk-CMBC4MXG.mjs";
|
|
5
|
+
import {
|
|
6
|
+
throttle
|
|
7
|
+
} from "../chunk-QOJGMVVR.mjs";
|
|
2
8
|
import {
|
|
3
9
|
debounce
|
|
4
10
|
} from "../chunk-3IP4JVLL.mjs";
|
|
@@ -8,12 +14,6 @@ import {
|
|
|
8
14
|
import {
|
|
9
15
|
noop
|
|
10
16
|
} from "../chunk-LKXCOLNY.mjs";
|
|
11
|
-
import {
|
|
12
|
-
once
|
|
13
|
-
} from "../chunk-CMBC4MXG.mjs";
|
|
14
|
-
import {
|
|
15
|
-
throttle
|
|
16
|
-
} from "../chunk-QOJGMVVR.mjs";
|
|
17
17
|
import "../chunk-2MM5EJJX.mjs";
|
|
18
18
|
export {
|
|
19
19
|
debounce,
|
package/dist/index.d.mts
CHANGED
|
@@ -81,4 +81,5 @@ export { camelCase } from './string/camelCase.mjs';
|
|
|
81
81
|
export { snakeCase } from './string/snakeCase.mjs';
|
|
82
82
|
export { kebabCase } from './string/kebabCase.mjs';
|
|
83
83
|
export { lowerCase } from './string/lowerCase.mjs';
|
|
84
|
+
export { startCase } from './string/startCase.mjs';
|
|
84
85
|
export { capitalize } from './string/capitalize.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -81,4 +81,5 @@ export { camelCase } from './string/camelCase.js';
|
|
|
81
81
|
export { snakeCase } from './string/snakeCase.js';
|
|
82
82
|
export { kebabCase } from './string/kebabCase.js';
|
|
83
83
|
export { lowerCase } from './string/lowerCase.js';
|
|
84
|
+
export { startCase } from './string/startCase.js';
|
|
84
85
|
export { capitalize } from './string/capitalize.js';
|
package/dist/index.js
CHANGED
|
@@ -94,6 +94,7 @@ __export(src_exports, {
|
|
|
94
94
|
sampleSize: () => sampleSize,
|
|
95
95
|
shuffle: () => shuffle,
|
|
96
96
|
snakeCase: () => snakeCase,
|
|
97
|
+
startCase: () => startCase,
|
|
97
98
|
sum: () => sum,
|
|
98
99
|
sumBy: () => sumBy,
|
|
99
100
|
tail: () => tail,
|
|
@@ -990,6 +991,23 @@ var lowerCase = (str) => {
|
|
|
990
991
|
const words = getWords(str);
|
|
991
992
|
return words.map((word) => word.toLowerCase()).join(" ");
|
|
992
993
|
};
|
|
994
|
+
|
|
995
|
+
// src/string/startCase.ts
|
|
996
|
+
function startCase(str) {
|
|
997
|
+
const words = getWords(str.trim());
|
|
998
|
+
let result = "";
|
|
999
|
+
for (const word of words) {
|
|
1000
|
+
if (result) {
|
|
1001
|
+
result += " ";
|
|
1002
|
+
}
|
|
1003
|
+
if (word === word.toUpperCase()) {
|
|
1004
|
+
result += word;
|
|
1005
|
+
} else {
|
|
1006
|
+
result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
return result;
|
|
1010
|
+
}
|
|
993
1011
|
// Annotate the CommonJS export names for ESM import in node:
|
|
994
1012
|
0 && (module.exports = {
|
|
995
1013
|
AbortError,
|
|
@@ -1052,6 +1070,7 @@ var lowerCase = (str) => {
|
|
|
1052
1070
|
sampleSize,
|
|
1053
1071
|
shuffle,
|
|
1054
1072
|
snakeCase,
|
|
1073
|
+
startCase,
|
|
1055
1074
|
sum,
|
|
1056
1075
|
sumBy,
|
|
1057
1076
|
tail,
|