es-toolkit 1.13.1-dev.316 → 1.13.1-dev.318
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 +16 -16
- package/dist/browser.js +90 -0
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +25 -24
- package/dist/browser.mjs.map +1 -1
- package/dist/{chunk-HKO7DEJK.mjs → chunk-36ZJSTNA.mjs} +54 -50
- package/dist/{chunk-HKO7DEJK.mjs.map → chunk-36ZJSTNA.mjs.map} +1 -1
- package/dist/chunk-5CPXZFCB.mjs +93 -0
- package/dist/chunk-5CPXZFCB.mjs.map +1 -0
- package/dist/chunk-YXAOYIRV.mjs +1 -0
- package/dist/compat/index.d.mts +1 -0
- package/dist/compat/index.d.ts +1 -0
- package/dist/compat/index.js +91 -0
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +56 -52
- package/dist/function/index.mjs +9 -9
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -53
- 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.mjs +3 -3
- package/dist/string/index.mjs +3 -3
- package/package.json +1 -1
- package/umd/browser.global.js +1 -1
- package/dist/chunk-54TK5BIS.mjs +0 -1
- /package/dist/{chunk-54TK5BIS.mjs.map → chunk-YXAOYIRV.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import "./chunk-NKLIE2OI.mjs";
|
|
2
|
+
import "./chunk-4OIZM4HS.mjs";
|
|
3
|
+
import {
|
|
4
|
+
withTimeout
|
|
5
|
+
} from "./chunk-IIDZ3KAJ.mjs";
|
|
6
|
+
import "./chunk-CVVZHOJX.mjs";
|
|
2
7
|
import "./chunk-XT74R35S.mjs";
|
|
8
|
+
import {
|
|
9
|
+
snakeCase
|
|
10
|
+
} from "./chunk-F3WCQQET.mjs";
|
|
3
11
|
import {
|
|
4
12
|
startCase
|
|
5
13
|
} from "./chunk-QXTNZR7B.mjs";
|
|
@@ -15,19 +23,14 @@ import {
|
|
|
15
23
|
import {
|
|
16
24
|
lowerCase
|
|
17
25
|
} from "./chunk-5IKVJGHO.mjs";
|
|
18
|
-
import {
|
|
19
|
-
snakeCase
|
|
20
|
-
} from "./chunk-F3WCQQET.mjs";
|
|
21
26
|
import "./chunk-WVQ7YVRK.mjs";
|
|
22
|
-
import "./chunk-4OIZM4HS.mjs";
|
|
23
|
-
import {
|
|
24
|
-
withTimeout
|
|
25
|
-
} from "./chunk-IIDZ3KAJ.mjs";
|
|
26
|
-
import "./chunk-CVVZHOJX.mjs";
|
|
27
27
|
import {
|
|
28
28
|
delay
|
|
29
29
|
} from "./chunk-O64NE2P4.mjs";
|
|
30
30
|
import "./chunk-U4JWMVQK.mjs";
|
|
31
|
+
import {
|
|
32
|
+
isFunction
|
|
33
|
+
} from "./chunk-74CREQXW.mjs";
|
|
31
34
|
import {
|
|
32
35
|
isNil
|
|
33
36
|
} from "./chunk-WMM7TZLG.mjs";
|
|
@@ -49,10 +52,10 @@ import {
|
|
|
49
52
|
import {
|
|
50
53
|
isEqual
|
|
51
54
|
} from "./chunk-JYSV56US.mjs";
|
|
55
|
+
import "./chunk-YXAOYIRV.mjs";
|
|
52
56
|
import {
|
|
53
|
-
|
|
54
|
-
} from "./chunk-
|
|
55
|
-
import "./chunk-54TK5BIS.mjs";
|
|
57
|
+
invert
|
|
58
|
+
} from "./chunk-OLX53VEF.mjs";
|
|
56
59
|
import {
|
|
57
60
|
omit
|
|
58
61
|
} from "./chunk-WFZXCGEG.mjs";
|
|
@@ -68,15 +71,15 @@ import {
|
|
|
68
71
|
import {
|
|
69
72
|
clone
|
|
70
73
|
} from "./chunk-VRUTBJYS.mjs";
|
|
74
|
+
import {
|
|
75
|
+
cloneDeep
|
|
76
|
+
} from "./chunk-5CPXZFCB.mjs";
|
|
71
77
|
import {
|
|
72
78
|
flattenObject
|
|
73
79
|
} from "./chunk-XGQWTHW6.mjs";
|
|
74
80
|
import {
|
|
75
81
|
isPlainObject
|
|
76
82
|
} from "./chunk-MIGAC7F4.mjs";
|
|
77
|
-
import {
|
|
78
|
-
invert
|
|
79
|
-
} from "./chunk-OLX53VEF.mjs";
|
|
80
83
|
import "./chunk-FUS75PJ7.mjs";
|
|
81
84
|
import {
|
|
82
85
|
range
|
|
@@ -102,7 +105,29 @@ import {
|
|
|
102
105
|
import {
|
|
103
106
|
sum
|
|
104
107
|
} from "./chunk-2SLTL4KL.mjs";
|
|
108
|
+
import "./chunk-ZA2XI3OV.mjs";
|
|
109
|
+
import {
|
|
110
|
+
throttle
|
|
111
|
+
} from "./chunk-QOJGMVVR.mjs";
|
|
112
|
+
import {
|
|
113
|
+
after
|
|
114
|
+
} from "./chunk-OGZMEWPR.mjs";
|
|
115
|
+
import {
|
|
116
|
+
debounce
|
|
117
|
+
} from "./chunk-3IP4JVLL.mjs";
|
|
118
|
+
import {
|
|
119
|
+
negate
|
|
120
|
+
} from "./chunk-BOOQBJN2.mjs";
|
|
121
|
+
import {
|
|
122
|
+
noop
|
|
123
|
+
} from "./chunk-LKXCOLNY.mjs";
|
|
124
|
+
import {
|
|
125
|
+
once
|
|
126
|
+
} from "./chunk-CMBC4MXG.mjs";
|
|
105
127
|
import "./chunk-DDH7K4QM.mjs";
|
|
128
|
+
import {
|
|
129
|
+
zipObject
|
|
130
|
+
} from "./chunk-6GWEY5EL.mjs";
|
|
106
131
|
import {
|
|
107
132
|
zipWith
|
|
108
133
|
} from "./chunk-4KYXHZ4R.mjs";
|
|
@@ -128,8 +153,8 @@ import {
|
|
|
128
153
|
zip
|
|
129
154
|
} from "./chunk-OLORW442.mjs";
|
|
130
155
|
import {
|
|
131
|
-
|
|
132
|
-
} from "./chunk-
|
|
156
|
+
takeRightWhile
|
|
157
|
+
} from "./chunk-NTLX2MPV.mjs";
|
|
133
158
|
import {
|
|
134
159
|
takeWhile
|
|
135
160
|
} from "./chunk-2IXFGSUA.mjs";
|
|
@@ -145,6 +170,9 @@ import {
|
|
|
145
170
|
import {
|
|
146
171
|
unionWith
|
|
147
172
|
} from "./chunk-2ZCITDMK.mjs";
|
|
173
|
+
import {
|
|
174
|
+
uniqWith
|
|
175
|
+
} from "./chunk-237HGSZS.mjs";
|
|
148
176
|
import {
|
|
149
177
|
uniq
|
|
150
178
|
} from "./chunk-DVK2N4KC.mjs";
|
|
@@ -152,8 +180,8 @@ import {
|
|
|
152
180
|
uniqBy
|
|
153
181
|
} from "./chunk-B4COTK4K.mjs";
|
|
154
182
|
import {
|
|
155
|
-
|
|
156
|
-
} from "./chunk-
|
|
183
|
+
orderBy
|
|
184
|
+
} from "./chunk-7B7W36UP.mjs";
|
|
157
185
|
import {
|
|
158
186
|
partition
|
|
159
187
|
} from "./chunk-DN3NOZ3H.mjs";
|
|
@@ -182,8 +210,8 @@ import {
|
|
|
182
210
|
takeRight
|
|
183
211
|
} from "./chunk-N3QYJX4T.mjs";
|
|
184
212
|
import {
|
|
185
|
-
|
|
186
|
-
} from "./chunk-
|
|
213
|
+
initial
|
|
214
|
+
} from "./chunk-XPSOKBRZ.mjs";
|
|
187
215
|
import {
|
|
188
216
|
intersection
|
|
189
217
|
} from "./chunk-FVVSE2F2.mjs";
|
|
@@ -206,8 +234,8 @@ import {
|
|
|
206
234
|
minBy
|
|
207
235
|
} from "./chunk-IJD7FE2Z.mjs";
|
|
208
236
|
import {
|
|
209
|
-
|
|
210
|
-
} from "./chunk-
|
|
237
|
+
fill
|
|
238
|
+
} from "./chunk-YFN6KOC4.mjs";
|
|
211
239
|
import {
|
|
212
240
|
flatMap
|
|
213
241
|
} from "./chunk-UY76KTPE.mjs";
|
|
@@ -227,8 +255,8 @@ import {
|
|
|
227
255
|
head
|
|
228
256
|
} from "./chunk-HM2JT2RX.mjs";
|
|
229
257
|
import {
|
|
230
|
-
|
|
231
|
-
} from "./chunk-
|
|
258
|
+
countBy
|
|
259
|
+
} from "./chunk-CRSKT4WW.mjs";
|
|
232
260
|
import {
|
|
233
261
|
difference
|
|
234
262
|
} from "./chunk-JPUKH67K.mjs";
|
|
@@ -250,31 +278,6 @@ import {
|
|
|
250
278
|
import {
|
|
251
279
|
dropWhile
|
|
252
280
|
} from "./chunk-LJ2C6MVP.mjs";
|
|
253
|
-
import {
|
|
254
|
-
fill
|
|
255
|
-
} from "./chunk-YFN6KOC4.mjs";
|
|
256
|
-
import "./chunk-ZA2XI3OV.mjs";
|
|
257
|
-
import {
|
|
258
|
-
negate
|
|
259
|
-
} from "./chunk-BOOQBJN2.mjs";
|
|
260
|
-
import {
|
|
261
|
-
noop
|
|
262
|
-
} from "./chunk-LKXCOLNY.mjs";
|
|
263
|
-
import {
|
|
264
|
-
once
|
|
265
|
-
} from "./chunk-CMBC4MXG.mjs";
|
|
266
|
-
import {
|
|
267
|
-
throttle
|
|
268
|
-
} from "./chunk-QOJGMVVR.mjs";
|
|
269
|
-
import {
|
|
270
|
-
chunk
|
|
271
|
-
} from "./chunk-E6C5EZQA.mjs";
|
|
272
|
-
import {
|
|
273
|
-
compact
|
|
274
|
-
} from "./chunk-DTJJIMKJ.mjs";
|
|
275
|
-
import {
|
|
276
|
-
countBy
|
|
277
|
-
} from "./chunk-CRSKT4WW.mjs";
|
|
278
281
|
import "./chunk-F47GLYUU.mjs";
|
|
279
282
|
import {
|
|
280
283
|
AbortError
|
|
@@ -283,11 +286,11 @@ import {
|
|
|
283
286
|
TimeoutError
|
|
284
287
|
} from "./chunk-KIOYQRMQ.mjs";
|
|
285
288
|
import {
|
|
286
|
-
|
|
287
|
-
} from "./chunk-
|
|
289
|
+
chunk
|
|
290
|
+
} from "./chunk-E6C5EZQA.mjs";
|
|
288
291
|
import {
|
|
289
|
-
|
|
290
|
-
} from "./chunk-
|
|
292
|
+
compact
|
|
293
|
+
} from "./chunk-DTJJIMKJ.mjs";
|
|
291
294
|
import "./chunk-24FKGR6U.mjs";
|
|
292
295
|
export {
|
|
293
296
|
AbortError,
|
|
@@ -298,6 +301,7 @@ export {
|
|
|
298
301
|
chunk,
|
|
299
302
|
clamp,
|
|
300
303
|
clone,
|
|
304
|
+
cloneDeep,
|
|
301
305
|
compact,
|
|
302
306
|
countBy,
|
|
303
307
|
debounce,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a deep clone of the given object.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the object.
|
|
5
|
+
* @param {T} obj - The object to clone.
|
|
6
|
+
* @returns {T} - A deep clone of the given object.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Clone a primitive values
|
|
10
|
+
* const num = 29;
|
|
11
|
+
* const clonedNum = clone(num);
|
|
12
|
+
* console.log(clonedNum); // 29
|
|
13
|
+
* console.log(clonedNum === num) ; // true
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Clone an array
|
|
17
|
+
* const arr = [1, 2, 3];
|
|
18
|
+
* const clonedArr = clone(arr);
|
|
19
|
+
* console.log(clonedArr); // [1, 2, 3]
|
|
20
|
+
* console.log(clonedArr === arr); // false
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Clone an array with nested objects
|
|
24
|
+
* const arr = [1, { a: 1 }, [1, 2, 3]];
|
|
25
|
+
* const clonedArr = clone(arr);
|
|
26
|
+
* arr[1].a = 2;
|
|
27
|
+
* console.log(arr); // [2, { a: 2 }, [1, 2, 3]]
|
|
28
|
+
* console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]
|
|
29
|
+
* console.log(clonedArr === arr); // false
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Clone an object
|
|
33
|
+
* const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };
|
|
34
|
+
* const clonedObj = clone(obj);
|
|
35
|
+
* console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }
|
|
36
|
+
* console.log(clonedObj === obj); // false
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Clone an object with nested objects
|
|
40
|
+
* const obj = { a: 1, b: { c: 1 } };
|
|
41
|
+
* const clonedObj = clone(obj);
|
|
42
|
+
* obj.b.c = 2;
|
|
43
|
+
* console.log(obj); // { a: 1, b: { c: 2 } }
|
|
44
|
+
* console.log(clonedObj); // { a: 1, b: { c: 1 } }
|
|
45
|
+
* console.log(clonedObj === obj); // false
|
|
46
|
+
*/
|
|
47
|
+
declare function cloneDeep<T>(obj: T): Resolved<T>;
|
|
48
|
+
type Resolved<T> = Equal<T, ResolvedMain<T>> extends true ? T : ResolvedMain<T>;
|
|
49
|
+
type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
|
|
50
|
+
type ResolvedMain<T> = T extends [never] ? never : ValueOf<T> extends boolean | number | bigint | string ? ValueOf<T> : T extends (...args: any[]) => any ? never : T extends object ? ResolvedObject<T> : ValueOf<T>;
|
|
51
|
+
type ResolvedObject<T extends object> = T extends Array<infer U> ? IsTuple<T> extends true ? ResolvedTuple<T> : Array<ResolvedMain<U>> : T extends Set<infer U> ? Set<ResolvedMain<U>> : T extends Map<infer K, infer V> ? Map<ResolvedMain<K>, ResolvedMain<V>> : T extends WeakSet<any> | WeakMap<any, any> ? never : T extends Date | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array | ArrayBuffer | SharedArrayBuffer | DataView | Blob | File ? T : {
|
|
52
|
+
[P in keyof T]: ResolvedMain<T[P]>;
|
|
53
|
+
};
|
|
54
|
+
type ResolvedTuple<T extends readonly any[]> = T extends [] ? [] : T extends [infer F] ? [ResolvedMain<F>] : T extends [infer F, ...infer Rest extends readonly any[]] ? [ResolvedMain<F>, ...ResolvedTuple<Rest>] : T extends [(infer F)?] ? [ResolvedMain<F>?] : T extends [(infer F)?, ...infer Rest extends readonly any[]] ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>] : [];
|
|
55
|
+
type IsTuple<T extends readonly any[] | {
|
|
56
|
+
length: number;
|
|
57
|
+
}> = [T] extends [never] ? false : T extends readonly any[] ? number extends T['length'] ? false : true : false;
|
|
58
|
+
type ValueOf<Instance> = IsValueOf<Instance, boolean> extends true ? boolean : IsValueOf<Instance, number> extends true ? number : IsValueOf<Instance, string> extends true ? string : Instance;
|
|
59
|
+
type IsValueOf<Instance, O extends IValueOf<any>> = Instance extends O ? O extends IValueOf<infer Primitive> ? Instance extends Primitive ? false : true : false : false;
|
|
60
|
+
interface IValueOf<T> {
|
|
61
|
+
valueOf(): T;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { type Resolved, cloneDeep };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a deep clone of the given object.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the object.
|
|
5
|
+
* @param {T} obj - The object to clone.
|
|
6
|
+
* @returns {T} - A deep clone of the given object.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Clone a primitive values
|
|
10
|
+
* const num = 29;
|
|
11
|
+
* const clonedNum = clone(num);
|
|
12
|
+
* console.log(clonedNum); // 29
|
|
13
|
+
* console.log(clonedNum === num) ; // true
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Clone an array
|
|
17
|
+
* const arr = [1, 2, 3];
|
|
18
|
+
* const clonedArr = clone(arr);
|
|
19
|
+
* console.log(clonedArr); // [1, 2, 3]
|
|
20
|
+
* console.log(clonedArr === arr); // false
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Clone an array with nested objects
|
|
24
|
+
* const arr = [1, { a: 1 }, [1, 2, 3]];
|
|
25
|
+
* const clonedArr = clone(arr);
|
|
26
|
+
* arr[1].a = 2;
|
|
27
|
+
* console.log(arr); // [2, { a: 2 }, [1, 2, 3]]
|
|
28
|
+
* console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]
|
|
29
|
+
* console.log(clonedArr === arr); // false
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Clone an object
|
|
33
|
+
* const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };
|
|
34
|
+
* const clonedObj = clone(obj);
|
|
35
|
+
* console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }
|
|
36
|
+
* console.log(clonedObj === obj); // false
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Clone an object with nested objects
|
|
40
|
+
* const obj = { a: 1, b: { c: 1 } };
|
|
41
|
+
* const clonedObj = clone(obj);
|
|
42
|
+
* obj.b.c = 2;
|
|
43
|
+
* console.log(obj); // { a: 1, b: { c: 2 } }
|
|
44
|
+
* console.log(clonedObj); // { a: 1, b: { c: 1 } }
|
|
45
|
+
* console.log(clonedObj === obj); // false
|
|
46
|
+
*/
|
|
47
|
+
declare function cloneDeep<T>(obj: T): Resolved<T>;
|
|
48
|
+
type Resolved<T> = Equal<T, ResolvedMain<T>> extends true ? T : ResolvedMain<T>;
|
|
49
|
+
type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
|
|
50
|
+
type ResolvedMain<T> = T extends [never] ? never : ValueOf<T> extends boolean | number | bigint | string ? ValueOf<T> : T extends (...args: any[]) => any ? never : T extends object ? ResolvedObject<T> : ValueOf<T>;
|
|
51
|
+
type ResolvedObject<T extends object> = T extends Array<infer U> ? IsTuple<T> extends true ? ResolvedTuple<T> : Array<ResolvedMain<U>> : T extends Set<infer U> ? Set<ResolvedMain<U>> : T extends Map<infer K, infer V> ? Map<ResolvedMain<K>, ResolvedMain<V>> : T extends WeakSet<any> | WeakMap<any, any> ? never : T extends Date | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array | ArrayBuffer | SharedArrayBuffer | DataView | Blob | File ? T : {
|
|
52
|
+
[P in keyof T]: ResolvedMain<T[P]>;
|
|
53
|
+
};
|
|
54
|
+
type ResolvedTuple<T extends readonly any[]> = T extends [] ? [] : T extends [infer F] ? [ResolvedMain<F>] : T extends [infer F, ...infer Rest extends readonly any[]] ? [ResolvedMain<F>, ...ResolvedTuple<Rest>] : T extends [(infer F)?] ? [ResolvedMain<F>?] : T extends [(infer F)?, ...infer Rest extends readonly any[]] ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>] : [];
|
|
55
|
+
type IsTuple<T extends readonly any[] | {
|
|
56
|
+
length: number;
|
|
57
|
+
}> = [T] extends [never] ? false : T extends readonly any[] ? number extends T['length'] ? false : true : false;
|
|
58
|
+
type ValueOf<Instance> = IsValueOf<Instance, boolean> extends true ? boolean : IsValueOf<Instance, number> extends true ? number : IsValueOf<Instance, string> extends true ? string : Instance;
|
|
59
|
+
type IsValueOf<Instance, O extends IValueOf<any>> = Instance extends O ? O extends IValueOf<infer Primitive> ? Instance extends Primitive ? false : true : false : false;
|
|
60
|
+
interface IValueOf<T> {
|
|
61
|
+
valueOf(): T;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { type Resolved, cloneDeep };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/object/cloneDeep.ts
|
|
21
|
+
var cloneDeep_exports = {};
|
|
22
|
+
__export(cloneDeep_exports, {
|
|
23
|
+
cloneDeep: () => cloneDeep
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(cloneDeep_exports);
|
|
26
|
+
function cloneDeep(obj) {
|
|
27
|
+
if (isPrimitive(obj)) {
|
|
28
|
+
return obj;
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(obj)) {
|
|
31
|
+
return obj.map((item) => cloneDeep(item));
|
|
32
|
+
}
|
|
33
|
+
if (obj instanceof Date) {
|
|
34
|
+
return new Date(obj.getTime());
|
|
35
|
+
}
|
|
36
|
+
if (obj instanceof RegExp) {
|
|
37
|
+
return new RegExp(obj.source, obj.flags);
|
|
38
|
+
}
|
|
39
|
+
if (obj instanceof Map) {
|
|
40
|
+
const result = /* @__PURE__ */ new Map();
|
|
41
|
+
for (const [key, value] of obj.entries()) {
|
|
42
|
+
result.set(key, cloneDeep(value));
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
if (obj instanceof Set) {
|
|
47
|
+
const result = /* @__PURE__ */ new Set();
|
|
48
|
+
for (const value of obj.values()) {
|
|
49
|
+
result.add(cloneDeep(value));
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
if (isTypedArray(obj)) {
|
|
54
|
+
const result = new (Object.getPrototypeOf(obj)).constructor(obj.length);
|
|
55
|
+
for (let i = 0; i < obj.length; i++) {
|
|
56
|
+
result[i] = cloneDeep(obj[i]);
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
if (obj instanceof ArrayBuffer || obj instanceof SharedArrayBuffer) {
|
|
61
|
+
return obj.slice(0);
|
|
62
|
+
}
|
|
63
|
+
if (obj instanceof DataView) {
|
|
64
|
+
const result = new DataView(obj.buffer.slice(0));
|
|
65
|
+
cloneDeepHelper(obj, result);
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
if (typeof File !== "undefined" && obj instanceof File) {
|
|
69
|
+
const result = new File([obj], obj.name, { type: obj.type });
|
|
70
|
+
cloneDeepHelper(obj, result);
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
if (obj instanceof Blob) {
|
|
74
|
+
const result = new Blob([obj], { type: obj.type });
|
|
75
|
+
cloneDeepHelper(obj, result);
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
if (obj instanceof Error) {
|
|
79
|
+
const result = new obj.constructor();
|
|
80
|
+
result.message = obj.message;
|
|
81
|
+
result.name = obj.name;
|
|
82
|
+
result.stack = obj.stack;
|
|
83
|
+
result.cause = obj.cause;
|
|
84
|
+
cloneDeepHelper(obj, result);
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
if (typeof obj === "object" && obj !== null) {
|
|
88
|
+
const result = {};
|
|
89
|
+
cloneDeepHelper(obj, result);
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
if (typeof obj === "function") {
|
|
93
|
+
return void 0;
|
|
94
|
+
}
|
|
95
|
+
return obj;
|
|
96
|
+
}
|
|
97
|
+
function isPrimitive(value) {
|
|
98
|
+
return value == null || typeof value !== "object" && typeof value !== "function";
|
|
99
|
+
}
|
|
100
|
+
function cloneDeepHelper(obj, clonedObj) {
|
|
101
|
+
for (const key in obj) {
|
|
102
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
103
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
|
104
|
+
if (((descriptor == null ? void 0 : descriptor.writable) || (descriptor == null ? void 0 : descriptor.set)) && typeof (descriptor == null ? void 0 : descriptor.value) !== "function") {
|
|
105
|
+
clonedObj[key] = cloneDeep(obj[key]);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function isTypedArray(obj) {
|
|
111
|
+
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;
|
|
112
|
+
}
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
cloneDeep
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=cloneDeep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/object/cloneDeep.ts"],"sourcesContent":["/**\n * Creates a deep clone of the given object.\n *\n * @template T - The type of the object.\n * @param {T} obj - The object to clone.\n * @returns {T} - A deep clone of the given object.\n *\n * @example\n * // Clone a primitive values\n * const num = 29;\n * const clonedNum = clone(num);\n * console.log(clonedNum); // 29\n * console.log(clonedNum === num) ; // true\n *\n * @example\n * // Clone an array\n * const arr = [1, 2, 3];\n * const clonedArr = clone(arr);\n * console.log(clonedArr); // [1, 2, 3]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an array with nested objects\n * const arr = [1, { a: 1 }, [1, 2, 3]];\n * const clonedArr = clone(arr);\n * arr[1].a = 2;\n * console.log(arr); // [2, { a: 2 }, [1, 2, 3]]\n * console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an object\n * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };\n * const clonedObj = clone(obj);\n * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }\n * console.log(clonedObj === obj); // false\n *\n * @example\n * // Clone an object with nested objects\n * const obj = { a: 1, b: { c: 1 } };\n * const clonedObj = clone(obj);\n * obj.b.c = 2;\n * console.log(obj); // { a: 1, b: { c: 2 } }\n * console.log(clonedObj); // { a: 1, b: { c: 1 } }\n * console.log(clonedObj === obj); // false\n */\nexport function cloneDeep<T>(obj: T): Resolved<T> {\n if (isPrimitive(obj)) {\n return obj as Resolved<T>;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => cloneDeep(item)) as Resolved<T>;\n }\n\n if (obj instanceof Date) {\n return new Date(obj.getTime()) as Resolved<T>;\n }\n\n if (obj instanceof RegExp) {\n return new RegExp(obj.source, obj.flags) as Resolved<T>;\n }\n\n if (obj instanceof Map) {\n const result = new Map();\n for (const [key, value] of obj.entries()) {\n result.set(key, cloneDeep(value));\n }\n return result as Resolved<T>;\n }\n\n if (obj instanceof Set) {\n const result = new Set();\n for (const value of obj.values()) {\n result.add(cloneDeep(value));\n }\n return result as Resolved<T>;\n }\n\n if (isTypedArray(obj)) {\n const result = new (Object.getPrototypeOf(obj).constructor)(obj.length);\n for (let i = 0; i < obj.length; i++) {\n result[i] = cloneDeep(obj[i]);\n }\n return result as Resolved<T>;\n }\n\n if (obj instanceof ArrayBuffer || obj instanceof SharedArrayBuffer) {\n return obj.slice(0) as Resolved<T>;\n }\n\n if (obj instanceof DataView) {\n const result = new DataView(obj.buffer.slice(0));\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n // For legacy NodeJS support\n if (typeof File !== 'undefined' && obj instanceof File) {\n const result = new File([obj], obj.name, { type: obj.type });\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (obj instanceof Blob) {\n const result = new Blob([obj], { type: obj.type });\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (obj instanceof Error) {\n const result = new (obj.constructor as { new (): Error })();\n result.message = obj.message;\n result.name = obj.name;\n result.stack = obj.stack;\n result.cause = obj.cause;\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (typeof obj === 'object' && obj !== null) {\n const result = {};\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (typeof obj === 'function') {\n return void 0 as Resolved<T>;\n }\n\n return obj as Resolved<T>;\n}\n\ntype Primitive = null | undefined | string | number | boolean | symbol | bigint;\nfunction isPrimitive(value: unknown): value is Primitive {\n return value == null || (typeof value !== 'object' && typeof value !== 'function');\n}\n\n// eslint-disable-next-line\nfunction cloneDeepHelper(obj: any, clonedObj: any): void {\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const descriptor = Object.getOwnPropertyDescriptor(obj, key);\n if ((descriptor?.writable || descriptor?.set) && typeof descriptor?.value !== 'function') {\n clonedObj[key] = cloneDeep(obj[key]);\n }\n }\n }\n}\n\nfunction isTypedArray(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n obj: any\n): obj is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return (\n obj instanceof Uint8Array ||\n obj instanceof Uint8ClampedArray ||\n obj instanceof Uint16Array ||\n obj instanceof Uint32Array ||\n obj instanceof BigUint64Array ||\n obj instanceof Int8Array ||\n obj instanceof Int16Array ||\n obj instanceof Int32Array ||\n obj instanceof BigInt64Array ||\n obj instanceof Float32Array ||\n obj instanceof Float64Array\n );\n}\n\nexport type Resolved<T> = Equal<T, ResolvedMain<T>> extends true ? T : ResolvedMain<T>;\n\ntype Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;\n\ntype ResolvedMain<T> = T extends [never]\n ? never // (special trick for jsonable | null) type\n : ValueOf<T> extends boolean | number | bigint | string\n ? ValueOf<T>\n : T extends (...args: any[]) => any\n ? never\n : T extends object\n ? ResolvedObject<T>\n : ValueOf<T>;\n\ntype ResolvedObject<T extends object> =\n T extends Array<infer U>\n ? IsTuple<T> extends true\n ? ResolvedTuple<T>\n : Array<ResolvedMain<U>>\n : T extends Set<infer U>\n ? Set<ResolvedMain<U>>\n : T extends Map<infer K, infer V>\n ? Map<ResolvedMain<K>, ResolvedMain<V>>\n : T extends WeakSet<any> | WeakMap<any, any>\n ? never\n : T extends\n | Date\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array\n | ArrayBuffer\n | SharedArrayBuffer\n | DataView\n | Blob\n | File\n ? T\n : {\n [P in keyof T]: ResolvedMain<T[P]>;\n };\n\ntype ResolvedTuple<T extends readonly any[]> = T extends []\n ? []\n : T extends [infer F]\n ? [ResolvedMain<F>]\n : T extends [infer F, ...infer Rest extends readonly any[]]\n ? [ResolvedMain<F>, ...ResolvedTuple<Rest>]\n : T extends [(infer F)?]\n ? [ResolvedMain<F>?]\n : T extends [(infer F)?, ...infer Rest extends readonly any[]]\n ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>]\n : [];\n\ntype IsTuple<T extends readonly any[] | { length: number }> = [T] extends [never]\n ? false\n : T extends readonly any[]\n ? number extends T['length']\n ? false\n : true\n : false;\n\ntype ValueOf<Instance> =\n IsValueOf<Instance, boolean> extends true\n ? boolean\n : IsValueOf<Instance, number> extends true\n ? number\n : IsValueOf<Instance, string> extends true\n ? string\n : Instance;\n\ntype IsValueOf<Instance, O extends IValueOf<any>> = Instance extends O\n ? O extends IValueOf<infer Primitive>\n ? Instance extends Primitive\n ? false\n : true // not Primitive, but Object\n : false // cannot be\n : false;\n\ninterface IValueOf<T> {\n valueOf(): T;\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/object/index.d.mts
CHANGED
package/dist/object/index.d.ts
CHANGED
package/dist/object/index.js
CHANGED
|
@@ -35,6 +35,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
35
35
|
var object_exports = {};
|
|
36
36
|
__export(object_exports, {
|
|
37
37
|
clone: () => clone,
|
|
38
|
+
cloneDeep: () => cloneDeep,
|
|
38
39
|
flattenObject: () => flattenObject,
|
|
39
40
|
invert: () => invert,
|
|
40
41
|
omit: () => omit,
|
|
@@ -137,6 +138,95 @@ function isPrimitive(value) {
|
|
|
137
138
|
return value == null || typeof value !== "object" && typeof value !== "function";
|
|
138
139
|
}
|
|
139
140
|
|
|
141
|
+
// src/object/cloneDeep.ts
|
|
142
|
+
function cloneDeep(obj) {
|
|
143
|
+
if (isPrimitive2(obj)) {
|
|
144
|
+
return obj;
|
|
145
|
+
}
|
|
146
|
+
if (Array.isArray(obj)) {
|
|
147
|
+
return obj.map((item) => cloneDeep(item));
|
|
148
|
+
}
|
|
149
|
+
if (obj instanceof Date) {
|
|
150
|
+
return new Date(obj.getTime());
|
|
151
|
+
}
|
|
152
|
+
if (obj instanceof RegExp) {
|
|
153
|
+
return new RegExp(obj.source, obj.flags);
|
|
154
|
+
}
|
|
155
|
+
if (obj instanceof Map) {
|
|
156
|
+
const result = /* @__PURE__ */ new Map();
|
|
157
|
+
for (const [key, value] of obj.entries()) {
|
|
158
|
+
result.set(key, cloneDeep(value));
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
if (obj instanceof Set) {
|
|
163
|
+
const result = /* @__PURE__ */ new Set();
|
|
164
|
+
for (const value of obj.values()) {
|
|
165
|
+
result.add(cloneDeep(value));
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
if (isTypedArray(obj)) {
|
|
170
|
+
const result = new (Object.getPrototypeOf(obj)).constructor(obj.length);
|
|
171
|
+
for (let i = 0; i < obj.length; i++) {
|
|
172
|
+
result[i] = cloneDeep(obj[i]);
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
if (obj instanceof ArrayBuffer || obj instanceof SharedArrayBuffer) {
|
|
177
|
+
return obj.slice(0);
|
|
178
|
+
}
|
|
179
|
+
if (obj instanceof DataView) {
|
|
180
|
+
const result = new DataView(obj.buffer.slice(0));
|
|
181
|
+
cloneDeepHelper(obj, result);
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
if (typeof File !== "undefined" && obj instanceof File) {
|
|
185
|
+
const result = new File([obj], obj.name, { type: obj.type });
|
|
186
|
+
cloneDeepHelper(obj, result);
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
if (obj instanceof Blob) {
|
|
190
|
+
const result = new Blob([obj], { type: obj.type });
|
|
191
|
+
cloneDeepHelper(obj, result);
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
if (obj instanceof Error) {
|
|
195
|
+
const result = new obj.constructor();
|
|
196
|
+
result.message = obj.message;
|
|
197
|
+
result.name = obj.name;
|
|
198
|
+
result.stack = obj.stack;
|
|
199
|
+
result.cause = obj.cause;
|
|
200
|
+
cloneDeepHelper(obj, result);
|
|
201
|
+
return result;
|
|
202
|
+
}
|
|
203
|
+
if (typeof obj === "object" && obj !== null) {
|
|
204
|
+
const result = {};
|
|
205
|
+
cloneDeepHelper(obj, result);
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
if (typeof obj === "function") {
|
|
209
|
+
return void 0;
|
|
210
|
+
}
|
|
211
|
+
return obj;
|
|
212
|
+
}
|
|
213
|
+
function isPrimitive2(value) {
|
|
214
|
+
return value == null || typeof value !== "object" && typeof value !== "function";
|
|
215
|
+
}
|
|
216
|
+
function cloneDeepHelper(obj, clonedObj) {
|
|
217
|
+
for (const key in obj) {
|
|
218
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
219
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
|
220
|
+
if (((descriptor == null ? void 0 : descriptor.writable) || (descriptor == null ? void 0 : descriptor.set)) && typeof (descriptor == null ? void 0 : descriptor.value) !== "function") {
|
|
221
|
+
clonedObj[key] = cloneDeep(obj[key]);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function isTypedArray(obj) {
|
|
227
|
+
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;
|
|
228
|
+
}
|
|
229
|
+
|
|
140
230
|
// src/predicate/isPlainObject.ts
|
|
141
231
|
function isPlainObject(object) {
|
|
142
232
|
if (typeof object !== "object") {
|
|
@@ -186,6 +276,7 @@ function flattenObjectImpl(object, prefix = "") {
|
|
|
186
276
|
// Annotate the CommonJS export names for ESM import in node:
|
|
187
277
|
0 && (module.exports = {
|
|
188
278
|
clone,
|
|
279
|
+
cloneDeep,
|
|
189
280
|
flattenObject,
|
|
190
281
|
invert,
|
|
191
282
|
omit,
|