es-toolkit 1.11.0-dev.264 → 1.11.0
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 +19 -19
- package/dist/compat/index.d.mts +1 -33
- package/dist/compat/index.d.ts +1 -33
- package/dist/compat/index.js +6 -36
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +26 -54
- package/dist/compat/index.mjs.map +1 -1
- package/dist/function/index.mjs +3 -3
- package/dist/index.mjs +26 -26
- package/package.json +1 -21
package/dist/array/index.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import "../chunk-DDH7K4QM.mjs";
|
|
2
|
+
import {
|
|
3
|
+
without
|
|
4
|
+
} from "../chunk-PYEYV7BY.mjs";
|
|
2
5
|
import {
|
|
3
6
|
xor
|
|
4
7
|
} from "../chunk-L7FQX5MN.mjs";
|
|
@@ -17,12 +20,18 @@ import {
|
|
|
17
20
|
import {
|
|
18
21
|
zipWith
|
|
19
22
|
} from "../chunk-4KYXHZ4R.mjs";
|
|
23
|
+
import {
|
|
24
|
+
union
|
|
25
|
+
} from "../chunk-R6QA7PLZ.mjs";
|
|
20
26
|
import {
|
|
21
27
|
unionBy
|
|
22
28
|
} from "../chunk-NFS7RWWE.mjs";
|
|
23
29
|
import {
|
|
24
30
|
unionWith
|
|
25
31
|
} from "../chunk-2ZCITDMK.mjs";
|
|
32
|
+
import {
|
|
33
|
+
uniq
|
|
34
|
+
} from "../chunk-DVK2N4KC.mjs";
|
|
26
35
|
import {
|
|
27
36
|
uniqBy
|
|
28
37
|
} from "../chunk-B4COTK4K.mjs";
|
|
@@ -36,8 +45,10 @@ import {
|
|
|
36
45
|
unzipWith
|
|
37
46
|
} from "../chunk-IFNXROZR.mjs";
|
|
38
47
|
import {
|
|
39
|
-
|
|
40
|
-
} from "../chunk-
|
|
48
|
+
sampleSize
|
|
49
|
+
} from "../chunk-EHSKB6DF.mjs";
|
|
50
|
+
import "../chunk-GIWAOOFY.mjs";
|
|
51
|
+
import "../chunk-SYWMYQYJ.mjs";
|
|
41
52
|
import {
|
|
42
53
|
shuffle
|
|
43
54
|
} from "../chunk-G7UQ5PUR.mjs";
|
|
@@ -60,11 +71,8 @@ import {
|
|
|
60
71
|
toFilled
|
|
61
72
|
} from "../chunk-OP4OAKQJ.mjs";
|
|
62
73
|
import {
|
|
63
|
-
|
|
64
|
-
} from "../chunk-
|
|
65
|
-
import {
|
|
66
|
-
uniq
|
|
67
|
-
} from "../chunk-DVK2N4KC.mjs";
|
|
74
|
+
intersectionWith
|
|
75
|
+
} from "../chunk-XI7KRD2C.mjs";
|
|
68
76
|
import {
|
|
69
77
|
keyBy
|
|
70
78
|
} from "../chunk-AJKZMN2V.mjs";
|
|
@@ -87,10 +95,8 @@ import {
|
|
|
87
95
|
sample
|
|
88
96
|
} from "../chunk-2KNLZB7V.mjs";
|
|
89
97
|
import {
|
|
90
|
-
|
|
91
|
-
} from "../chunk-
|
|
92
|
-
import "../chunk-GIWAOOFY.mjs";
|
|
93
|
-
import "../chunk-SYWMYQYJ.mjs";
|
|
98
|
+
flattenDeep
|
|
99
|
+
} from "../chunk-ML727RRJ.mjs";
|
|
94
100
|
import {
|
|
95
101
|
forEachRight
|
|
96
102
|
} from "../chunk-IEA53J7P.mjs";
|
|
@@ -110,8 +116,8 @@ import {
|
|
|
110
116
|
intersectionBy
|
|
111
117
|
} from "../chunk-O6UXZR3U.mjs";
|
|
112
118
|
import {
|
|
113
|
-
|
|
114
|
-
} from "../chunk-
|
|
119
|
+
differenceWith
|
|
120
|
+
} from "../chunk-6NVQAHXP.mjs";
|
|
115
121
|
import {
|
|
116
122
|
drop
|
|
117
123
|
} from "../chunk-3EZAFZG3.mjs";
|
|
@@ -130,9 +136,6 @@ import {
|
|
|
130
136
|
import {
|
|
131
137
|
flatMap
|
|
132
138
|
} from "../chunk-UY76KTPE.mjs";
|
|
133
|
-
import {
|
|
134
|
-
flattenDeep
|
|
135
|
-
} from "../chunk-ML727RRJ.mjs";
|
|
136
139
|
import {
|
|
137
140
|
flatten
|
|
138
141
|
} from "../chunk-33MSBDC6.mjs";
|
|
@@ -151,9 +154,6 @@ import {
|
|
|
151
154
|
import {
|
|
152
155
|
differenceBy
|
|
153
156
|
} from "../chunk-LVWX5B43.mjs";
|
|
154
|
-
import {
|
|
155
|
-
differenceWith
|
|
156
|
-
} from "../chunk-6NVQAHXP.mjs";
|
|
157
157
|
import "../chunk-424M7IR7.mjs";
|
|
158
158
|
export {
|
|
159
159
|
chunk,
|
package/dist/compat/index.d.mts
CHANGED
|
@@ -465,36 +465,4 @@ declare const startsWith: (str: string, target: string, position?: number) => bo
|
|
|
465
465
|
*/
|
|
466
466
|
declare const endsWith: (str: string, target: string, position?: number) => boolean;
|
|
467
467
|
|
|
468
|
-
|
|
469
|
-
* Finds the element in an array that has the maximum value.
|
|
470
|
-
*
|
|
471
|
-
* @template T - The type of elements in the array.
|
|
472
|
-
* @param {T[]} items The array of elements to search.
|
|
473
|
-
* @returns {T} The element with the maximum value.
|
|
474
|
-
* @example
|
|
475
|
-
* // Returns 9
|
|
476
|
-
* max([3, 1, 4, 1, 5, 9])
|
|
477
|
-
*
|
|
478
|
-
* @example
|
|
479
|
-
* // Returns 8
|
|
480
|
-
* max([0, -3, 2, 8, 7])
|
|
481
|
-
*/
|
|
482
|
-
declare function max<T>(items?: readonly T[]): T;
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Finds the element in an array that has the minimum value.
|
|
486
|
-
*
|
|
487
|
-
* @template T - The type of elements in the array.
|
|
488
|
-
* @param {T[]} items The array of elements to search.
|
|
489
|
-
* @returns {T} The element with the minimum value.
|
|
490
|
-
* @example
|
|
491
|
-
* // Returns 1
|
|
492
|
-
* min([3, 1, 4, 1, 5, 9])
|
|
493
|
-
*
|
|
494
|
-
* @example
|
|
495
|
-
* // Returns -3
|
|
496
|
-
* min([0, -3, 2, 8, 7])
|
|
497
|
-
*/
|
|
498
|
-
declare function min<T>(items?: readonly T[]): T;
|
|
499
|
-
|
|
500
|
-
export { chunk, endsWith, get, max, min, set, startsWith, zipObjectDeep };
|
|
468
|
+
export { chunk, endsWith, get, set, startsWith, zipObjectDeep };
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -465,36 +465,4 @@ declare const startsWith: (str: string, target: string, position?: number) => bo
|
|
|
465
465
|
*/
|
|
466
466
|
declare const endsWith: (str: string, target: string, position?: number) => boolean;
|
|
467
467
|
|
|
468
|
-
|
|
469
|
-
* Finds the element in an array that has the maximum value.
|
|
470
|
-
*
|
|
471
|
-
* @template T - The type of elements in the array.
|
|
472
|
-
* @param {T[]} items The array of elements to search.
|
|
473
|
-
* @returns {T} The element with the maximum value.
|
|
474
|
-
* @example
|
|
475
|
-
* // Returns 9
|
|
476
|
-
* max([3, 1, 4, 1, 5, 9])
|
|
477
|
-
*
|
|
478
|
-
* @example
|
|
479
|
-
* // Returns 8
|
|
480
|
-
* max([0, -3, 2, 8, 7])
|
|
481
|
-
*/
|
|
482
|
-
declare function max<T>(items?: readonly T[]): T;
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Finds the element in an array that has the minimum value.
|
|
486
|
-
*
|
|
487
|
-
* @template T - The type of elements in the array.
|
|
488
|
-
* @param {T[]} items The array of elements to search.
|
|
489
|
-
* @returns {T} The element with the minimum value.
|
|
490
|
-
* @example
|
|
491
|
-
* // Returns 1
|
|
492
|
-
* min([3, 1, 4, 1, 5, 9])
|
|
493
|
-
*
|
|
494
|
-
* @example
|
|
495
|
-
* // Returns -3
|
|
496
|
-
* min([0, -3, 2, 8, 7])
|
|
497
|
-
*/
|
|
498
|
-
declare function min<T>(items?: readonly T[]): T;
|
|
499
|
-
|
|
500
|
-
export { chunk, endsWith, get, max, min, set, startsWith, zipObjectDeep };
|
|
468
|
+
export { chunk, endsWith, get, set, startsWith, zipObjectDeep };
|
package/dist/compat/index.js
CHANGED
|
@@ -96,11 +96,9 @@ __export(compat_exports, {
|
|
|
96
96
|
keyBy: () => keyBy,
|
|
97
97
|
last: () => last,
|
|
98
98
|
lowerCase: () => lowerCase,
|
|
99
|
-
max: () => max,
|
|
100
99
|
maxBy: () => maxBy,
|
|
101
100
|
mean: () => mean,
|
|
102
101
|
meanBy: () => meanBy,
|
|
103
|
-
min: () => min,
|
|
104
102
|
minBy: () => minBy,
|
|
105
103
|
negate: () => negate,
|
|
106
104
|
noop: () => noop,
|
|
@@ -340,11 +338,11 @@ function keyBy(arr, getKeyFromItem) {
|
|
|
340
338
|
// src/array/maxBy.ts
|
|
341
339
|
function maxBy(items, getValue) {
|
|
342
340
|
let maxElement = items[0];
|
|
343
|
-
let
|
|
341
|
+
let max = -Infinity;
|
|
344
342
|
for (const element of items) {
|
|
345
343
|
const value = getValue(element);
|
|
346
|
-
if (value >
|
|
347
|
-
|
|
344
|
+
if (value > max) {
|
|
345
|
+
max = value;
|
|
348
346
|
maxElement = element;
|
|
349
347
|
}
|
|
350
348
|
}
|
|
@@ -354,11 +352,11 @@ function maxBy(items, getValue) {
|
|
|
354
352
|
// src/array/minBy.ts
|
|
355
353
|
function minBy(items, getValue) {
|
|
356
354
|
let minElement = items[0];
|
|
357
|
-
let
|
|
355
|
+
let min = Infinity;
|
|
358
356
|
for (const element of items) {
|
|
359
357
|
const value = getValue(element);
|
|
360
|
-
if (value <
|
|
361
|
-
|
|
358
|
+
if (value < min) {
|
|
359
|
+
min = value;
|
|
362
360
|
minElement = element;
|
|
363
361
|
}
|
|
364
362
|
}
|
|
@@ -1206,32 +1204,6 @@ var startsWith = (str, target, position = 0) => {
|
|
|
1206
1204
|
var endsWith = (str, target, position = str.length) => {
|
|
1207
1205
|
return str.endsWith(target, position);
|
|
1208
1206
|
};
|
|
1209
|
-
|
|
1210
|
-
// src/compat/math/max.ts
|
|
1211
|
-
function max(items = []) {
|
|
1212
|
-
let maxElement = items[0];
|
|
1213
|
-
let max2 = void 0;
|
|
1214
|
-
for (const element of items) {
|
|
1215
|
-
if (max2 == null || element > max2) {
|
|
1216
|
-
max2 = element;
|
|
1217
|
-
maxElement = element;
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
return maxElement;
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
// src/compat/math/min.ts
|
|
1224
|
-
function min(items = []) {
|
|
1225
|
-
let minElement = items[0];
|
|
1226
|
-
let min2 = void 0;
|
|
1227
|
-
for (const element of items) {
|
|
1228
|
-
if (min2 == null || element < min2) {
|
|
1229
|
-
min2 = element;
|
|
1230
|
-
minElement = element;
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
return minElement;
|
|
1234
|
-
}
|
|
1235
1207
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1236
1208
|
0 && (module.exports = {
|
|
1237
1209
|
AbortError,
|
|
@@ -1276,11 +1248,9 @@ function min(items = []) {
|
|
|
1276
1248
|
keyBy,
|
|
1277
1249
|
last,
|
|
1278
1250
|
lowerCase,
|
|
1279
|
-
max,
|
|
1280
1251
|
maxBy,
|
|
1281
1252
|
mean,
|
|
1282
1253
|
meanBy,
|
|
1283
|
-
min,
|
|
1284
1254
|
minBy,
|
|
1285
1255
|
negate,
|
|
1286
1256
|
noop,
|