es-toolkit 1.13.1-dev.317 → 1.13.1-dev.320
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 +49 -49
- package/dist/browser.js +101 -0
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +45 -43
- package/dist/browser.mjs.map +1 -1
- package/dist/chunk-5CPXZFCB.mjs +93 -0
- package/dist/chunk-5CPXZFCB.mjs.map +1 -0
- package/dist/chunk-STL6TD3L.mjs +1 -0
- package/dist/chunk-SXFMQQ6F.mjs +9 -0
- package/dist/chunk-SXFMQQ6F.mjs.map +1 -0
- package/dist/{chunk-HKO7DEJK.mjs → chunk-YNJH6GEG.mjs} +98 -84
- package/dist/chunk-YNJH6GEG.mjs.map +1 -0
- package/dist/chunk-YXAOYIRV.mjs +1 -0
- package/dist/compat/index.d.mts +20 -1
- package/dist/compat/index.d.ts +20 -1
- package/dist/compat/index.js +103 -0
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +98 -91
- package/dist/error/index.mjs +3 -3
- package/dist/function/index.mjs +9 -9
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +98 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -90
- package/dist/object/cloneDeep.d.mts +64 -0
- package/dist/object/cloneDeep.d.ts +64 -0
- package/dist/object/cloneDeep.js +117 -0
- package/dist/object/cloneDeep.js.map +1 -0
- package/dist/object/cloneDeep.mjs +8 -0
- package/dist/object/cloneDeep.mjs.map +1 -0
- package/dist/object/index.d.mts +1 -0
- package/dist/object/index.d.ts +1 -0
- package/dist/object/index.js +91 -0
- package/dist/object/index.js.map +1 -1
- package/dist/object/index.mjs +8 -4
- package/dist/predicate/index.d.mts +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +7 -0
- package/dist/predicate/index.js.map +1 -1
- package/dist/predicate/index.mjs +8 -4
- package/dist/predicate/isTypedArray.d.mts +19 -0
- package/dist/predicate/isTypedArray.d.ts +19 -0
- package/dist/predicate/isTypedArray.js +33 -0
- package/dist/predicate/isTypedArray.js.map +1 -0
- package/dist/predicate/isTypedArray.mjs +8 -0
- package/dist/predicate/isTypedArray.mjs.map +1 -0
- package/dist/promise/index.mjs +1 -1
- package/dist/promise/timeout.mjs +1 -1
- package/dist/promise/withTimeout.mjs +1 -1
- package/dist/string/index.mjs +6 -6
- package/package.json +1 -1
- package/umd/browser.global.js +1 -1
- package/dist/chunk-54TK5BIS.mjs +0 -1
- package/dist/chunk-HKO7DEJK.mjs.map +0 -1
- package/dist/chunk-U4JWMVQK.mjs +0 -1
- /package/dist/{chunk-54TK5BIS.mjs.map → chunk-STL6TD3L.mjs.map} +0 -0
- /package/dist/{chunk-U4JWMVQK.mjs.map → chunk-YXAOYIRV.mjs.map} +0 -0
package/dist/array/index.mjs
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import "../chunk-DDH7K4QM.mjs";
|
|
2
|
-
import {
|
|
3
|
-
zipWith
|
|
4
|
-
} from "../chunk-4KYXHZ4R.mjs";
|
|
5
|
-
import {
|
|
6
|
-
unzip
|
|
7
|
-
} from "../chunk-UYZKMBDO.mjs";
|
|
8
|
-
import {
|
|
9
|
-
unzipWith
|
|
10
|
-
} from "../chunk-IFNXROZR.mjs";
|
|
11
|
-
import {
|
|
12
|
-
without
|
|
13
|
-
} from "../chunk-PYEYV7BY.mjs";
|
|
14
2
|
import {
|
|
15
3
|
xor
|
|
16
4
|
} from "../chunk-L7FQX5MN.mjs";
|
|
@@ -27,23 +15,14 @@ import {
|
|
|
27
15
|
zipObject
|
|
28
16
|
} from "../chunk-6GWEY5EL.mjs";
|
|
29
17
|
import {
|
|
30
|
-
|
|
31
|
-
} from "../chunk-
|
|
32
|
-
import {
|
|
33
|
-
toFilled
|
|
34
|
-
} from "../chunk-OP4OAKQJ.mjs";
|
|
35
|
-
import {
|
|
36
|
-
union
|
|
37
|
-
} from "../chunk-R6QA7PLZ.mjs";
|
|
18
|
+
zipWith
|
|
19
|
+
} from "../chunk-4KYXHZ4R.mjs";
|
|
38
20
|
import {
|
|
39
21
|
unionBy
|
|
40
22
|
} from "../chunk-NFS7RWWE.mjs";
|
|
41
23
|
import {
|
|
42
24
|
unionWith
|
|
43
25
|
} from "../chunk-2ZCITDMK.mjs";
|
|
44
|
-
import {
|
|
45
|
-
uniq
|
|
46
|
-
} from "../chunk-DVK2N4KC.mjs";
|
|
47
26
|
import {
|
|
48
27
|
uniqBy
|
|
49
28
|
} from "../chunk-B4COTK4K.mjs";
|
|
@@ -51,16 +30,14 @@ import {
|
|
|
51
30
|
uniqWith
|
|
52
31
|
} from "../chunk-237HGSZS.mjs";
|
|
53
32
|
import {
|
|
54
|
-
|
|
55
|
-
} from "../chunk-
|
|
33
|
+
unzip
|
|
34
|
+
} from "../chunk-UYZKMBDO.mjs";
|
|
56
35
|
import {
|
|
57
|
-
|
|
58
|
-
} from "../chunk-
|
|
36
|
+
unzipWith
|
|
37
|
+
} from "../chunk-IFNXROZR.mjs";
|
|
59
38
|
import {
|
|
60
|
-
|
|
61
|
-
} from "../chunk-
|
|
62
|
-
import "../chunk-GIWAOOFY.mjs";
|
|
63
|
-
import "../chunk-SYWMYQYJ.mjs";
|
|
39
|
+
without
|
|
40
|
+
} from "../chunk-PYEYV7BY.mjs";
|
|
64
41
|
import {
|
|
65
42
|
shuffle
|
|
66
43
|
} from "../chunk-G7UQ5PUR.mjs";
|
|
@@ -77,14 +54,17 @@ import {
|
|
|
77
54
|
takeRightWhile
|
|
78
55
|
} from "../chunk-NTLX2MPV.mjs";
|
|
79
56
|
import {
|
|
80
|
-
|
|
81
|
-
} from "../chunk-
|
|
57
|
+
takeWhile
|
|
58
|
+
} from "../chunk-2IXFGSUA.mjs";
|
|
82
59
|
import {
|
|
83
|
-
|
|
84
|
-
} from "../chunk-
|
|
60
|
+
toFilled
|
|
61
|
+
} from "../chunk-OP4OAKQJ.mjs";
|
|
85
62
|
import {
|
|
86
|
-
|
|
87
|
-
} from "../chunk-
|
|
63
|
+
union
|
|
64
|
+
} from "../chunk-R6QA7PLZ.mjs";
|
|
65
|
+
import {
|
|
66
|
+
uniq
|
|
67
|
+
} from "../chunk-DVK2N4KC.mjs";
|
|
88
68
|
import {
|
|
89
69
|
keyBy
|
|
90
70
|
} from "../chunk-AJKZMN2V.mjs";
|
|
@@ -101,14 +81,16 @@ import {
|
|
|
101
81
|
orderBy
|
|
102
82
|
} from "../chunk-7B7W36UP.mjs";
|
|
103
83
|
import {
|
|
104
|
-
|
|
105
|
-
} from "../chunk-
|
|
84
|
+
partition
|
|
85
|
+
} from "../chunk-DN3NOZ3H.mjs";
|
|
106
86
|
import {
|
|
107
|
-
|
|
108
|
-
} from "../chunk-
|
|
87
|
+
sample
|
|
88
|
+
} from "../chunk-2KNLZB7V.mjs";
|
|
109
89
|
import {
|
|
110
|
-
|
|
111
|
-
} from "../chunk-
|
|
90
|
+
sampleSize
|
|
91
|
+
} from "../chunk-EHSKB6DF.mjs";
|
|
92
|
+
import "../chunk-GIWAOOFY.mjs";
|
|
93
|
+
import "../chunk-SYWMYQYJ.mjs";
|
|
112
94
|
import {
|
|
113
95
|
forEachRight
|
|
114
96
|
} from "../chunk-IEA53J7P.mjs";
|
|
@@ -122,14 +104,14 @@ import {
|
|
|
122
104
|
initial
|
|
123
105
|
} from "../chunk-XPSOKBRZ.mjs";
|
|
124
106
|
import {
|
|
125
|
-
|
|
126
|
-
} from "../chunk-
|
|
107
|
+
intersection
|
|
108
|
+
} from "../chunk-FVVSE2F2.mjs";
|
|
127
109
|
import {
|
|
128
|
-
|
|
129
|
-
} from "../chunk-
|
|
110
|
+
intersectionBy
|
|
111
|
+
} from "../chunk-O6UXZR3U.mjs";
|
|
130
112
|
import {
|
|
131
|
-
|
|
132
|
-
} from "../chunk-
|
|
113
|
+
intersectionWith
|
|
114
|
+
} from "../chunk-XI7KRD2C.mjs";
|
|
133
115
|
import {
|
|
134
116
|
drop
|
|
135
117
|
} from "../chunk-3EZAFZG3.mjs";
|
|
@@ -145,6 +127,15 @@ import {
|
|
|
145
127
|
import {
|
|
146
128
|
fill
|
|
147
129
|
} from "../chunk-YFN6KOC4.mjs";
|
|
130
|
+
import {
|
|
131
|
+
flatMap
|
|
132
|
+
} from "../chunk-UY76KTPE.mjs";
|
|
133
|
+
import {
|
|
134
|
+
flattenDeep
|
|
135
|
+
} from "../chunk-ML727RRJ.mjs";
|
|
136
|
+
import {
|
|
137
|
+
flatten
|
|
138
|
+
} from "../chunk-33MSBDC6.mjs";
|
|
148
139
|
import {
|
|
149
140
|
chunk
|
|
150
141
|
} from "../chunk-E6C5EZQA.mjs";
|
|
@@ -154,6 +145,15 @@ import {
|
|
|
154
145
|
import {
|
|
155
146
|
countBy
|
|
156
147
|
} from "../chunk-CRSKT4WW.mjs";
|
|
148
|
+
import {
|
|
149
|
+
difference
|
|
150
|
+
} from "../chunk-JPUKH67K.mjs";
|
|
151
|
+
import {
|
|
152
|
+
differenceBy
|
|
153
|
+
} from "../chunk-LVWX5B43.mjs";
|
|
154
|
+
import {
|
|
155
|
+
differenceWith
|
|
156
|
+
} from "../chunk-6NVQAHXP.mjs";
|
|
157
157
|
import "../chunk-24FKGR6U.mjs";
|
|
158
158
|
export {
|
|
159
159
|
chunk,
|
package/dist/browser.js
CHANGED
|
@@ -51,6 +51,7 @@ __export(compat_exports, {
|
|
|
51
51
|
chunk: () => chunk2,
|
|
52
52
|
clamp: () => clamp,
|
|
53
53
|
clone: () => clone,
|
|
54
|
+
cloneDeep: () => cloneDeep,
|
|
54
55
|
compact: () => compact,
|
|
55
56
|
concat: () => concat,
|
|
56
57
|
countBy: () => countBy,
|
|
@@ -89,6 +90,7 @@ __export(compat_exports, {
|
|
|
89
90
|
isNotNil: () => isNotNil,
|
|
90
91
|
isNull: () => isNull,
|
|
91
92
|
isPlainObject: () => isPlainObject2,
|
|
93
|
+
isTypedArray: () => isTypedArray3,
|
|
92
94
|
isUndefined: () => isUndefined,
|
|
93
95
|
kebabCase: () => kebabCase,
|
|
94
96
|
keyBy: () => keyBy,
|
|
@@ -937,6 +939,95 @@ function isPrimitive(value) {
|
|
|
937
939
|
return value == null || typeof value !== "object" && typeof value !== "function";
|
|
938
940
|
}
|
|
939
941
|
|
|
942
|
+
// src/object/cloneDeep.ts
|
|
943
|
+
function cloneDeep(obj) {
|
|
944
|
+
if (isPrimitive2(obj)) {
|
|
945
|
+
return obj;
|
|
946
|
+
}
|
|
947
|
+
if (Array.isArray(obj)) {
|
|
948
|
+
return obj.map((item) => cloneDeep(item));
|
|
949
|
+
}
|
|
950
|
+
if (obj instanceof Date) {
|
|
951
|
+
return new Date(obj.getTime());
|
|
952
|
+
}
|
|
953
|
+
if (obj instanceof RegExp) {
|
|
954
|
+
return new RegExp(obj.source, obj.flags);
|
|
955
|
+
}
|
|
956
|
+
if (obj instanceof Map) {
|
|
957
|
+
const result = /* @__PURE__ */ new Map();
|
|
958
|
+
for (const [key, value] of obj.entries()) {
|
|
959
|
+
result.set(key, cloneDeep(value));
|
|
960
|
+
}
|
|
961
|
+
return result;
|
|
962
|
+
}
|
|
963
|
+
if (obj instanceof Set) {
|
|
964
|
+
const result = /* @__PURE__ */ new Set();
|
|
965
|
+
for (const value of obj.values()) {
|
|
966
|
+
result.add(cloneDeep(value));
|
|
967
|
+
}
|
|
968
|
+
return result;
|
|
969
|
+
}
|
|
970
|
+
if (isTypedArray(obj)) {
|
|
971
|
+
const result = new (Object.getPrototypeOf(obj)).constructor(obj.length);
|
|
972
|
+
for (let i = 0; i < obj.length; i++) {
|
|
973
|
+
result[i] = cloneDeep(obj[i]);
|
|
974
|
+
}
|
|
975
|
+
return result;
|
|
976
|
+
}
|
|
977
|
+
if (obj instanceof ArrayBuffer || obj instanceof SharedArrayBuffer) {
|
|
978
|
+
return obj.slice(0);
|
|
979
|
+
}
|
|
980
|
+
if (obj instanceof DataView) {
|
|
981
|
+
const result = new DataView(obj.buffer.slice(0));
|
|
982
|
+
cloneDeepHelper(obj, result);
|
|
983
|
+
return result;
|
|
984
|
+
}
|
|
985
|
+
if (typeof File !== "undefined" && obj instanceof File) {
|
|
986
|
+
const result = new File([obj], obj.name, { type: obj.type });
|
|
987
|
+
cloneDeepHelper(obj, result);
|
|
988
|
+
return result;
|
|
989
|
+
}
|
|
990
|
+
if (obj instanceof Blob) {
|
|
991
|
+
const result = new Blob([obj], { type: obj.type });
|
|
992
|
+
cloneDeepHelper(obj, result);
|
|
993
|
+
return result;
|
|
994
|
+
}
|
|
995
|
+
if (obj instanceof Error) {
|
|
996
|
+
const result = new obj.constructor();
|
|
997
|
+
result.message = obj.message;
|
|
998
|
+
result.name = obj.name;
|
|
999
|
+
result.stack = obj.stack;
|
|
1000
|
+
result.cause = obj.cause;
|
|
1001
|
+
cloneDeepHelper(obj, result);
|
|
1002
|
+
return result;
|
|
1003
|
+
}
|
|
1004
|
+
if (typeof obj === "object" && obj !== null) {
|
|
1005
|
+
const result = {};
|
|
1006
|
+
cloneDeepHelper(obj, result);
|
|
1007
|
+
return result;
|
|
1008
|
+
}
|
|
1009
|
+
if (typeof obj === "function") {
|
|
1010
|
+
return void 0;
|
|
1011
|
+
}
|
|
1012
|
+
return obj;
|
|
1013
|
+
}
|
|
1014
|
+
function isPrimitive2(value) {
|
|
1015
|
+
return value == null || typeof value !== "object" && typeof value !== "function";
|
|
1016
|
+
}
|
|
1017
|
+
function cloneDeepHelper(obj, clonedObj) {
|
|
1018
|
+
for (const key in obj) {
|
|
1019
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
1020
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
|
1021
|
+
if (((descriptor == null ? void 0 : descriptor.writable) || (descriptor == null ? void 0 : descriptor.set)) && typeof (descriptor == null ? void 0 : descriptor.value) !== "function") {
|
|
1022
|
+
clonedObj[key] = cloneDeep(obj[key]);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
function isTypedArray(obj) {
|
|
1028
|
+
return obj instanceof Uint8Array || obj instanceof Uint8ClampedArray || obj instanceof Uint16Array || obj instanceof Uint32Array || obj instanceof BigUint64Array || obj instanceof Int8Array || obj instanceof Int16Array || obj instanceof Int32Array || obj instanceof BigInt64Array || obj instanceof Float32Array || obj instanceof Float64Array;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
940
1031
|
// src/predicate/isPlainObject.ts
|
|
941
1032
|
function isPlainObject(object) {
|
|
942
1033
|
if (typeof object !== "object") {
|
|
@@ -1052,6 +1143,11 @@ function isArrayLike(value) {
|
|
|
1052
1143
|
return value != null && typeof value !== "function" && isLength(value.length);
|
|
1053
1144
|
}
|
|
1054
1145
|
|
|
1146
|
+
// src/predicate/isTypedArray.ts
|
|
1147
|
+
function isTypedArray2(x) {
|
|
1148
|
+
return x instanceof Uint8Array || x instanceof Uint8ClampedArray || x instanceof Uint16Array || x instanceof Uint32Array || x instanceof BigUint64Array || x instanceof Int8Array || x instanceof Int16Array || x instanceof Int32Array || x instanceof BigInt64Array || x instanceof Float32Array || x instanceof Float64Array;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1055
1151
|
// src/promise/delay.ts
|
|
1056
1152
|
function delay(ms, { signal } = {}) {
|
|
1057
1153
|
return new Promise((resolve, reject) => {
|
|
@@ -1334,6 +1430,11 @@ function isArray(value) {
|
|
|
1334
1430
|
return Array.isArray(value);
|
|
1335
1431
|
}
|
|
1336
1432
|
|
|
1433
|
+
// src/compat/predicate/isTypedArray.ts
|
|
1434
|
+
function isTypedArray3(x) {
|
|
1435
|
+
return isTypedArray2(x);
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1337
1438
|
// src/compat/string/startsWith.ts
|
|
1338
1439
|
var startsWith = (str, target, position = 0) => {
|
|
1339
1440
|
return str.startsWith(target, position);
|