@visulima/deep-clone 2.1.10 → 3.0.1
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/CHANGELOG.md +34 -0
- package/LICENSE.md +1 -1
- package/README.md +62 -9
- package/dist/handler.js +1 -0
- package/dist/index.js +1 -0
- package/dist/packem_shared/copyArrayBuffer-_dUBQIVn.js +1 -0
- package/dist/packem_shared/copyArrayLoose-BEBF0PeG.js +1 -0
- package/dist/packem_shared/copyBlob-S-Z7ux38.js +1 -0
- package/dist/packem_shared/copyDataView-EF9L1_xC.js +1 -0
- package/dist/packem_shared/copyDate-b-cxY0ZF.js +1 -0
- package/dist/packem_shared/copyError-Bdcealjm.js +1 -0
- package/dist/packem_shared/copyMapLoose-BodEbKp7.js +1 -0
- package/dist/packem_shared/copyObjectLoose-C5x-tHKP.js +1 -0
- package/dist/packem_shared/copyOwnProperties-QEhjt2x8.js +1 -0
- package/dist/packem_shared/copyRegExpLoose-Cio6jQWx.js +1 -0
- package/dist/packem_shared/copySetLoose-L-swSTFR.js +1 -0
- package/dist/packem_shared/getCleanClone-D0FN9QGR.js +1 -0
- package/dist/utils.js +1 -0
- package/package.json +8 -42
- package/dist/handler.cjs +0 -32
- package/dist/handler.d.cts +0 -33
- package/dist/handler.d.mts +0 -33
- package/dist/handler.mjs +0 -10
- package/dist/index.cjs +0 -121
- package/dist/index.d.cts +0 -9
- package/dist/index.d.mts +0 -9
- package/dist/index.mjs +0 -117
- package/dist/packem_shared/copyArrayBuffer-CCGJtx0g.cjs +0 -36
- package/dist/packem_shared/copyArrayBuffer-DnYU3Ab_.mjs +0 -34
- package/dist/packem_shared/copyArrayLoose-DutO2eEt.mjs +0 -19
- package/dist/packem_shared/copyArrayLoose-jv5B0O8W.cjs +0 -24
- package/dist/packem_shared/copyBlob-B8SnIatQ.cjs +0 -7
- package/dist/packem_shared/copyBlob-ChzBsdC1.mjs +0 -5
- package/dist/packem_shared/copyDataView-BJMKTRTm.mjs +0 -7
- package/dist/packem_shared/copyDataView-DHMi5seB.cjs +0 -9
- package/dist/packem_shared/copyDate-Bgbm3mwe.mjs +0 -5
- package/dist/packem_shared/copyDate-CSIVko_l.cjs +0 -7
- package/dist/packem_shared/copyError-8k5J3dj4.mjs +0 -22
- package/dist/packem_shared/copyError-C1oK1eBT.cjs +0 -24
- package/dist/packem_shared/copyMapLoose-6OISt6H6.mjs +0 -15
- package/dist/packem_shared/copyMapLoose-DpoR0LmV.cjs +0 -20
- package/dist/packem_shared/copyObjectLoose-C0Xe4P0E.mjs +0 -47
- package/dist/packem_shared/copyObjectLoose-PHaYRVaE.cjs +0 -52
- package/dist/packem_shared/copyOwnProperties-FDDRgAnK.mjs +0 -30
- package/dist/packem_shared/copyOwnProperties-NdANNH2P.cjs +0 -32
- package/dist/packem_shared/copyRegExpLoose-455kIpwH.cjs +0 -20
- package/dist/packem_shared/copyRegExpLoose-CPAMvOoY.mjs +0 -15
- package/dist/packem_shared/copySetLoose-BBgAFOdx.cjs +0 -20
- package/dist/packem_shared/copySetLoose-BIxHjmWz.mjs +0 -15
- package/dist/packem_shared/getCleanClone-BhfRMqgx.cjs +0 -22
- package/dist/packem_shared/getCleanClone-Ch3gqIzM.mjs +0 -20
- package/dist/packem_shared/types-_Qve7nv8.d.cts +0 -31
- package/dist/packem_shared/types-_Qve7nv8.d.mts +0 -31
- package/dist/utils.cjs +0 -11
- package/dist/utils.d.cts +0 -7
- package/dist/utils.d.mts +0 -7
- package/dist/utils.mjs +0 -2
package/dist/index.mjs
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { copyArrayStrict, copyArrayLoose } from './packem_shared/copyArrayLoose-DutO2eEt.mjs';
|
|
2
|
-
import copyArrayBuffer from './packem_shared/copyArrayBuffer-DnYU3Ab_.mjs';
|
|
3
|
-
import copyBlob from './packem_shared/copyBlob-ChzBsdC1.mjs';
|
|
4
|
-
import copyDataView from './packem_shared/copyDataView-BJMKTRTm.mjs';
|
|
5
|
-
import copyDate from './packem_shared/copyDate-Bgbm3mwe.mjs';
|
|
6
|
-
import copyError from './packem_shared/copyError-8k5J3dj4.mjs';
|
|
7
|
-
import { copyMapStrict, copyMapLoose } from './packem_shared/copyMapLoose-6OISt6H6.mjs';
|
|
8
|
-
import { copyObjectStrict, copyObjectLoose } from './packem_shared/copyObjectLoose-C0Xe4P0E.mjs';
|
|
9
|
-
import { copyRegExpStrict, copyRegExpLoose } from './packem_shared/copyRegExpLoose-CPAMvOoY.mjs';
|
|
10
|
-
import { copySetStrict, copySetLoose } from './packem_shared/copySetLoose-BIxHjmWz.mjs';
|
|
11
|
-
|
|
12
|
-
var __defProp = Object.defineProperty;
|
|
13
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
14
|
-
const canValueHaveProperties = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null || typeof value === "function", "canValueHaveProperties");
|
|
15
|
-
const handlers = {
|
|
16
|
-
Array: copyArrayLoose,
|
|
17
|
-
ArrayBuffer: copyArrayBuffer,
|
|
18
|
-
Blob: copyBlob,
|
|
19
|
-
DataView: copyDataView,
|
|
20
|
-
Date: copyDate,
|
|
21
|
-
Error: copyError,
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/no-unused-vars
|
|
23
|
-
Function: /* @__PURE__ */ __name((object, _state) => object, "Function"),
|
|
24
|
-
Map: copyMapLoose,
|
|
25
|
-
Object: copyObjectLoose,
|
|
26
|
-
Promise: /* @__PURE__ */ __name((object) => {
|
|
27
|
-
throw new TypeError(`${object.constructor.name} objects cannot be cloned`);
|
|
28
|
-
}, "Promise"),
|
|
29
|
-
RegExp: copyRegExpLoose,
|
|
30
|
-
Set: copySetLoose,
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
-
SharedArrayBuffer: /* @__PURE__ */ __name((object, _state) => {
|
|
33
|
-
throw new TypeError(`${object.constructor.name} objects cannot be cloned`);
|
|
34
|
-
}, "SharedArrayBuffer"),
|
|
35
|
-
WeakMap: /* @__PURE__ */ __name((object) => {
|
|
36
|
-
throw new TypeError(`${object.constructor.name} objects cannot be cloned`);
|
|
37
|
-
}, "WeakMap"),
|
|
38
|
-
WeakSet: /* @__PURE__ */ __name((object) => {
|
|
39
|
-
throw new TypeError(`${object.constructor.name} objects cannot be cloned`);
|
|
40
|
-
}, "WeakSet")
|
|
41
|
-
};
|
|
42
|
-
const deepClone = /* @__PURE__ */ __name((originalData, options) => {
|
|
43
|
-
if (!canValueHaveProperties(originalData)) {
|
|
44
|
-
return originalData;
|
|
45
|
-
}
|
|
46
|
-
const cloner = {
|
|
47
|
-
...handlers,
|
|
48
|
-
...options?.strict ? { Array: copyArrayStrict, Map: copyMapStrict, Object: copyObjectStrict, RegExp: copyRegExpStrict, Set: copySetStrict } : {},
|
|
49
|
-
...options?.handler
|
|
50
|
-
};
|
|
51
|
-
let cache = /* @__PURE__ */ new WeakMap();
|
|
52
|
-
const clone = /* @__PURE__ */ __name((value, state) => {
|
|
53
|
-
if (!canValueHaveProperties(value)) {
|
|
54
|
-
return value;
|
|
55
|
-
}
|
|
56
|
-
if (state.cache.has(value)) {
|
|
57
|
-
return state.cache.get(value);
|
|
58
|
-
}
|
|
59
|
-
if (Array.isArray(value)) {
|
|
60
|
-
return cloner.Array(value, state);
|
|
61
|
-
}
|
|
62
|
-
if (typeof value === "object" && value.constructor === Object && value.nodeType === void 0) {
|
|
63
|
-
return cloner.Object(value, state);
|
|
64
|
-
}
|
|
65
|
-
if (value.nodeType !== void 0 && value.cloneNode !== void 0) {
|
|
66
|
-
return value.cloneNode(true);
|
|
67
|
-
}
|
|
68
|
-
if (value instanceof Date) {
|
|
69
|
-
return cloner.Date(value, state);
|
|
70
|
-
}
|
|
71
|
-
if (value instanceof RegExp) {
|
|
72
|
-
return cloner.RegExp(value, state);
|
|
73
|
-
}
|
|
74
|
-
if (value instanceof Map) {
|
|
75
|
-
return cloner.Map(value, state);
|
|
76
|
-
}
|
|
77
|
-
if (value instanceof Set) {
|
|
78
|
-
return cloner.Set(value, state);
|
|
79
|
-
}
|
|
80
|
-
if (value instanceof Error) {
|
|
81
|
-
return cloner.Error(value, state);
|
|
82
|
-
}
|
|
83
|
-
if (value instanceof ArrayBuffer || value instanceof Uint8Array || value instanceof Uint8ClampedArray || value instanceof Int8Array || value instanceof Uint16Array || value instanceof Int16Array || value instanceof Uint32Array || value instanceof Int32Array || value instanceof Float32Array || value instanceof Float64Array) {
|
|
84
|
-
return cloner.ArrayBuffer(value, state);
|
|
85
|
-
}
|
|
86
|
-
if (value instanceof Blob) {
|
|
87
|
-
return cloner.Blob(value, state);
|
|
88
|
-
}
|
|
89
|
-
if (value instanceof DataView) {
|
|
90
|
-
return cloner.DataView(value, state);
|
|
91
|
-
}
|
|
92
|
-
if (value instanceof SharedArrayBuffer) {
|
|
93
|
-
return cloner.SharedArrayBuffer(value, state);
|
|
94
|
-
}
|
|
95
|
-
if (value instanceof Promise) {
|
|
96
|
-
return cloner.Promise(value, state);
|
|
97
|
-
}
|
|
98
|
-
if (value instanceof WeakMap) {
|
|
99
|
-
return cloner.WeakMap(value, state);
|
|
100
|
-
}
|
|
101
|
-
if (value instanceof WeakSet) {
|
|
102
|
-
return cloner.WeakSet(value, state);
|
|
103
|
-
}
|
|
104
|
-
if (value instanceof Function) {
|
|
105
|
-
return cloner.Function(value, state);
|
|
106
|
-
}
|
|
107
|
-
if (typeof value === "object") {
|
|
108
|
-
return cloner.Object(value, state);
|
|
109
|
-
}
|
|
110
|
-
throw new TypeError(`Type of ${typeof value} cannot be cloned`, value);
|
|
111
|
-
}, "clone");
|
|
112
|
-
const cloned = clone(originalData, { cache, clone });
|
|
113
|
-
cache = null;
|
|
114
|
-
return cloned;
|
|
115
|
-
}, "deepClone");
|
|
116
|
-
|
|
117
|
-
export { deepClone };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const copyArrayBuffer = /* @__PURE__ */ __name((arrayBuffer) => {
|
|
6
|
-
const typeHandlers = {
|
|
7
|
-
BigInt64Array,
|
|
8
|
-
BigUint64Array,
|
|
9
|
-
// @ts-expect-error - Buffer has no constructor
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
11
|
-
Buffer: Buffer.from,
|
|
12
|
-
Float32Array,
|
|
13
|
-
Float64Array,
|
|
14
|
-
Int8Array,
|
|
15
|
-
Int16Array,
|
|
16
|
-
Int32Array,
|
|
17
|
-
Uint8Array,
|
|
18
|
-
Uint8ClampedArray,
|
|
19
|
-
Uint16Array,
|
|
20
|
-
Uint32Array
|
|
21
|
-
};
|
|
22
|
-
if (arrayBuffer instanceof ArrayBuffer) {
|
|
23
|
-
const newBuffer = new ArrayBuffer(arrayBuffer.byteLength);
|
|
24
|
-
const origView = new Uint8Array(arrayBuffer);
|
|
25
|
-
const newView = new Uint8Array(newBuffer);
|
|
26
|
-
newView.set(origView);
|
|
27
|
-
return newBuffer;
|
|
28
|
-
}
|
|
29
|
-
const Ctor = typeHandlers[arrayBuffer.constructor.name] ?? void 0;
|
|
30
|
-
if (Ctor) {
|
|
31
|
-
return new Ctor(arrayBuffer);
|
|
32
|
-
}
|
|
33
|
-
return new arrayBuffer.constructor([...arrayBuffer.buffer], arrayBuffer.byteOffset, arrayBuffer.length);
|
|
34
|
-
}, "copyArrayBuffer");
|
|
35
|
-
|
|
36
|
-
module.exports = copyArrayBuffer;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const copyArrayBuffer = /* @__PURE__ */ __name((arrayBuffer) => {
|
|
4
|
-
const typeHandlers = {
|
|
5
|
-
BigInt64Array,
|
|
6
|
-
BigUint64Array,
|
|
7
|
-
// @ts-expect-error - Buffer has no constructor
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
9
|
-
Buffer: Buffer.from,
|
|
10
|
-
Float32Array,
|
|
11
|
-
Float64Array,
|
|
12
|
-
Int8Array,
|
|
13
|
-
Int16Array,
|
|
14
|
-
Int32Array,
|
|
15
|
-
Uint8Array,
|
|
16
|
-
Uint8ClampedArray,
|
|
17
|
-
Uint16Array,
|
|
18
|
-
Uint32Array
|
|
19
|
-
};
|
|
20
|
-
if (arrayBuffer instanceof ArrayBuffer) {
|
|
21
|
-
const newBuffer = new ArrayBuffer(arrayBuffer.byteLength);
|
|
22
|
-
const origView = new Uint8Array(arrayBuffer);
|
|
23
|
-
const newView = new Uint8Array(newBuffer);
|
|
24
|
-
newView.set(origView);
|
|
25
|
-
return newBuffer;
|
|
26
|
-
}
|
|
27
|
-
const Ctor = typeHandlers[arrayBuffer.constructor.name] ?? void 0;
|
|
28
|
-
if (Ctor) {
|
|
29
|
-
return new Ctor(arrayBuffer);
|
|
30
|
-
}
|
|
31
|
-
return new arrayBuffer.constructor([...arrayBuffer.buffer], arrayBuffer.byteOffset, arrayBuffer.length);
|
|
32
|
-
}, "copyArrayBuffer");
|
|
33
|
-
|
|
34
|
-
export { copyArrayBuffer as default };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import copyOwnProperties from './copyOwnProperties-FDDRgAnK.mjs';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const copyArrayLoose = /* @__PURE__ */ __name((array, state) => {
|
|
6
|
-
const clone = [];
|
|
7
|
-
state.cache.set(array, clone);
|
|
8
|
-
for (let index = 0, { length } = array; index < length; ++index) {
|
|
9
|
-
clone[index] = state.clone(array[index], state);
|
|
10
|
-
}
|
|
11
|
-
return clone;
|
|
12
|
-
}, "copyArrayLoose");
|
|
13
|
-
const copyArrayStrict = /* @__PURE__ */ __name((array, state) => {
|
|
14
|
-
const clone = [];
|
|
15
|
-
state.cache.set(array, clone);
|
|
16
|
-
return copyOwnProperties(array, clone, state);
|
|
17
|
-
}, "copyArrayStrict");
|
|
18
|
-
|
|
19
|
-
export { copyArrayLoose, copyArrayStrict };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
-
|
|
5
|
-
const copyOwnProperties = require('./copyOwnProperties-NdANNH2P.cjs');
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
-
const copyArrayLoose = /* @__PURE__ */ __name((array, state) => {
|
|
10
|
-
const clone = [];
|
|
11
|
-
state.cache.set(array, clone);
|
|
12
|
-
for (let index = 0, { length } = array; index < length; ++index) {
|
|
13
|
-
clone[index] = state.clone(array[index], state);
|
|
14
|
-
}
|
|
15
|
-
return clone;
|
|
16
|
-
}, "copyArrayLoose");
|
|
17
|
-
const copyArrayStrict = /* @__PURE__ */ __name((array, state) => {
|
|
18
|
-
const clone = [];
|
|
19
|
-
state.cache.set(array, clone);
|
|
20
|
-
return copyOwnProperties(array, clone, state);
|
|
21
|
-
}, "copyArrayStrict");
|
|
22
|
-
|
|
23
|
-
exports.copyArrayLoose = copyArrayLoose;
|
|
24
|
-
exports.copyArrayStrict = copyArrayStrict;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const copyBlob = /* @__PURE__ */ __name((blob) => blob.slice(0, blob.size, blob.type), "copyBlob");
|
|
6
|
-
|
|
7
|
-
module.exports = copyBlob;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import copyArrayBuffer from './copyArrayBuffer-DnYU3Ab_.mjs';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const copyDataView = /* @__PURE__ */ __name((dataView) => new DataView(copyArrayBuffer(dataView.buffer)), "copyDataView");
|
|
6
|
-
|
|
7
|
-
export { copyDataView as default };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const copyArrayBuffer = require('./copyArrayBuffer-CCGJtx0g.cjs');
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
const copyDataView = /* @__PURE__ */ __name((dataView) => new DataView(copyArrayBuffer(dataView.buffer)), "copyDataView");
|
|
8
|
-
|
|
9
|
-
module.exports = copyDataView;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const copyDate = /* @__PURE__ */ __name((date) => new Date(date.getTime()), "copyDate");
|
|
6
|
-
|
|
7
|
-
module.exports = copyDate;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import copyOwnProperties from './copyOwnProperties-FDDRgAnK.mjs';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const copyError = /* @__PURE__ */ __name((object, state) => {
|
|
6
|
-
const error = new object.constructor(object.message);
|
|
7
|
-
if (object.stack) {
|
|
8
|
-
error.stack = object.stack;
|
|
9
|
-
}
|
|
10
|
-
if (object.code) {
|
|
11
|
-
error.code = object.code;
|
|
12
|
-
}
|
|
13
|
-
if (object.errno) {
|
|
14
|
-
error.errno = object.errno;
|
|
15
|
-
}
|
|
16
|
-
if (object.syscall) {
|
|
17
|
-
error.syscall = object.syscall;
|
|
18
|
-
}
|
|
19
|
-
return copyOwnProperties(object, error, state);
|
|
20
|
-
}, "copyError");
|
|
21
|
-
|
|
22
|
-
export { copyError as default };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const copyOwnProperties = require('./copyOwnProperties-NdANNH2P.cjs');
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
const copyError = /* @__PURE__ */ __name((object, state) => {
|
|
8
|
-
const error = new object.constructor(object.message);
|
|
9
|
-
if (object.stack) {
|
|
10
|
-
error.stack = object.stack;
|
|
11
|
-
}
|
|
12
|
-
if (object.code) {
|
|
13
|
-
error.code = object.code;
|
|
14
|
-
}
|
|
15
|
-
if (object.errno) {
|
|
16
|
-
error.errno = object.errno;
|
|
17
|
-
}
|
|
18
|
-
if (object.syscall) {
|
|
19
|
-
error.syscall = object.syscall;
|
|
20
|
-
}
|
|
21
|
-
return copyOwnProperties(object, error, state);
|
|
22
|
-
}, "copyError");
|
|
23
|
-
|
|
24
|
-
module.exports = copyError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import copyOwnProperties from './copyOwnProperties-FDDRgAnK.mjs';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const copyMapLoose = /* @__PURE__ */ __name((map, state) => {
|
|
6
|
-
const clone = /* @__PURE__ */ new Map();
|
|
7
|
-
state.cache.set(map, clone);
|
|
8
|
-
map.forEach((value, key) => {
|
|
9
|
-
clone.set(key, state.clone(value, state));
|
|
10
|
-
});
|
|
11
|
-
return clone;
|
|
12
|
-
}, "copyMapLoose");
|
|
13
|
-
const copyMapStrict = /* @__PURE__ */ __name((map, state) => copyOwnProperties(map, copyMapLoose(map, state), state), "copyMapStrict");
|
|
14
|
-
|
|
15
|
-
export { copyMapLoose, copyMapStrict };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
-
|
|
5
|
-
const copyOwnProperties = require('./copyOwnProperties-NdANNH2P.cjs');
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
-
const copyMapLoose = /* @__PURE__ */ __name((map, state) => {
|
|
10
|
-
const clone = /* @__PURE__ */ new Map();
|
|
11
|
-
state.cache.set(map, clone);
|
|
12
|
-
map.forEach((value, key) => {
|
|
13
|
-
clone.set(key, state.clone(value, state));
|
|
14
|
-
});
|
|
15
|
-
return clone;
|
|
16
|
-
}, "copyMapLoose");
|
|
17
|
-
const copyMapStrict = /* @__PURE__ */ __name((map, state) => copyOwnProperties(map, copyMapLoose(map, state), state), "copyMapStrict");
|
|
18
|
-
|
|
19
|
-
exports.copyMapLoose = copyMapLoose;
|
|
20
|
-
exports.copyMapStrict = copyMapStrict;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import copyOwnProperties from './copyOwnProperties-FDDRgAnK.mjs';
|
|
2
|
-
import getCleanClone from './getCleanClone-Ch3gqIzM.mjs';
|
|
3
|
-
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
-
const copyObjectIsFunctions = /* @__PURE__ */ __name((object, clone) => {
|
|
7
|
-
if (!Object.isExtensible(object)) {
|
|
8
|
-
Object.preventExtensions(clone);
|
|
9
|
-
}
|
|
10
|
-
if (Object.isSealed(object)) {
|
|
11
|
-
Object.seal(clone);
|
|
12
|
-
}
|
|
13
|
-
if (Object.isFrozen(object)) {
|
|
14
|
-
Object.freeze(clone);
|
|
15
|
-
}
|
|
16
|
-
}, "copyObjectIsFunctions");
|
|
17
|
-
const copyObjectLoose = /* @__PURE__ */ __name((object, state) => {
|
|
18
|
-
const clone = getCleanClone(object);
|
|
19
|
-
state.cache.set(object, clone);
|
|
20
|
-
for (const key in object) {
|
|
21
|
-
if (Object.hasOwnProperty.call(object, key)) {
|
|
22
|
-
clone[key] = state.clone(object[key], state);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const symbols = Object.getOwnPropertySymbols(object);
|
|
26
|
-
for (let index = 0, { length } = symbols, symbol; index < length; ++index) {
|
|
27
|
-
symbol = symbols[index];
|
|
28
|
-
if (Object.prototype.propertyIsEnumerable.call(object, symbol)) {
|
|
29
|
-
clone[symbol] = state.clone(object[symbol], state);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
copyObjectIsFunctions(object, clone);
|
|
33
|
-
return clone;
|
|
34
|
-
}, "copyObjectLoose");
|
|
35
|
-
const copyObjectStrict = /* @__PURE__ */ __name((object, state) => {
|
|
36
|
-
const clone = getCleanClone(object);
|
|
37
|
-
state.cache.set(object, clone);
|
|
38
|
-
const clonedObject = copyOwnProperties(object, clone, state);
|
|
39
|
-
const objectPrototype = Object.getPrototypeOf(object);
|
|
40
|
-
if (Object.getPrototypeOf(clonedObject) !== objectPrototype) {
|
|
41
|
-
Object.setPrototypeOf(clonedObject, objectPrototype);
|
|
42
|
-
}
|
|
43
|
-
copyObjectIsFunctions(object, clone);
|
|
44
|
-
return clonedObject;
|
|
45
|
-
}, "copyObjectStrict");
|
|
46
|
-
|
|
47
|
-
export { copyObjectLoose, copyObjectStrict };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
-
|
|
5
|
-
const copyOwnProperties = require('./copyOwnProperties-NdANNH2P.cjs');
|
|
6
|
-
const getCleanClone = require('./getCleanClone-BhfRMqgx.cjs');
|
|
7
|
-
|
|
8
|
-
var __defProp = Object.defineProperty;
|
|
9
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
-
const copyObjectIsFunctions = /* @__PURE__ */ __name((object, clone) => {
|
|
11
|
-
if (!Object.isExtensible(object)) {
|
|
12
|
-
Object.preventExtensions(clone);
|
|
13
|
-
}
|
|
14
|
-
if (Object.isSealed(object)) {
|
|
15
|
-
Object.seal(clone);
|
|
16
|
-
}
|
|
17
|
-
if (Object.isFrozen(object)) {
|
|
18
|
-
Object.freeze(clone);
|
|
19
|
-
}
|
|
20
|
-
}, "copyObjectIsFunctions");
|
|
21
|
-
const copyObjectLoose = /* @__PURE__ */ __name((object, state) => {
|
|
22
|
-
const clone = getCleanClone(object);
|
|
23
|
-
state.cache.set(object, clone);
|
|
24
|
-
for (const key in object) {
|
|
25
|
-
if (Object.hasOwnProperty.call(object, key)) {
|
|
26
|
-
clone[key] = state.clone(object[key], state);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
const symbols = Object.getOwnPropertySymbols(object);
|
|
30
|
-
for (let index = 0, { length } = symbols, symbol; index < length; ++index) {
|
|
31
|
-
symbol = symbols[index];
|
|
32
|
-
if (Object.prototype.propertyIsEnumerable.call(object, symbol)) {
|
|
33
|
-
clone[symbol] = state.clone(object[symbol], state);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
copyObjectIsFunctions(object, clone);
|
|
37
|
-
return clone;
|
|
38
|
-
}, "copyObjectLoose");
|
|
39
|
-
const copyObjectStrict = /* @__PURE__ */ __name((object, state) => {
|
|
40
|
-
const clone = getCleanClone(object);
|
|
41
|
-
state.cache.set(object, clone);
|
|
42
|
-
const clonedObject = copyOwnProperties(object, clone, state);
|
|
43
|
-
const objectPrototype = Object.getPrototypeOf(object);
|
|
44
|
-
if (Object.getPrototypeOf(clonedObject) !== objectPrototype) {
|
|
45
|
-
Object.setPrototypeOf(clonedObject, objectPrototype);
|
|
46
|
-
}
|
|
47
|
-
copyObjectIsFunctions(object, clone);
|
|
48
|
-
return clonedObject;
|
|
49
|
-
}, "copyObjectStrict");
|
|
50
|
-
|
|
51
|
-
exports.copyObjectLoose = copyObjectLoose;
|
|
52
|
-
exports.copyObjectStrict = copyObjectStrict;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const getStrictProperties = /* @__PURE__ */ __name((object) => [
|
|
4
|
-
...Object.getOwnPropertyNames(object),
|
|
5
|
-
...Object.getOwnPropertySymbols(object)
|
|
6
|
-
], "getStrictProperties");
|
|
7
|
-
const copyOwnProperties = /* @__PURE__ */ __name((value, clone, state) => {
|
|
8
|
-
const properties = getStrictProperties(value);
|
|
9
|
-
for (const property of properties) {
|
|
10
|
-
if (property === "callee" || property === "caller") {
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
const descriptor = Object.getOwnPropertyDescriptor(value, property);
|
|
14
|
-
if (!descriptor) {
|
|
15
|
-
clone[property] = state.clone(value[property], state);
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
if (!descriptor.get && !descriptor.set) {
|
|
19
|
-
descriptor.value = state.clone(descriptor.value, state);
|
|
20
|
-
}
|
|
21
|
-
try {
|
|
22
|
-
Object.defineProperty(clone, property, descriptor);
|
|
23
|
-
} catch {
|
|
24
|
-
clone[property] = descriptor.value;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return clone;
|
|
28
|
-
}, "copyOwnProperties");
|
|
29
|
-
|
|
30
|
-
export { copyOwnProperties as default };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const getStrictProperties = /* @__PURE__ */ __name((object) => [
|
|
6
|
-
...Object.getOwnPropertyNames(object),
|
|
7
|
-
...Object.getOwnPropertySymbols(object)
|
|
8
|
-
], "getStrictProperties");
|
|
9
|
-
const copyOwnProperties = /* @__PURE__ */ __name((value, clone, state) => {
|
|
10
|
-
const properties = getStrictProperties(value);
|
|
11
|
-
for (const property of properties) {
|
|
12
|
-
if (property === "callee" || property === "caller") {
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
const descriptor = Object.getOwnPropertyDescriptor(value, property);
|
|
16
|
-
if (!descriptor) {
|
|
17
|
-
clone[property] = state.clone(value[property], state);
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
if (!descriptor.get && !descriptor.set) {
|
|
21
|
-
descriptor.value = state.clone(descriptor.value, state);
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
Object.defineProperty(clone, property, descriptor);
|
|
25
|
-
} catch {
|
|
26
|
-
clone[property] = descriptor.value;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return clone;
|
|
30
|
-
}, "copyOwnProperties");
|
|
31
|
-
|
|
32
|
-
module.exports = copyOwnProperties;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
-
|
|
5
|
-
const copyOwnProperties = require('./copyOwnProperties-NdANNH2P.cjs');
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
-
const copyRegExpLoose = /* @__PURE__ */ __name((regExp) => {
|
|
10
|
-
const clone = new RegExp(regExp.source, regExp.flags);
|
|
11
|
-
clone.lastIndex = regExp.lastIndex;
|
|
12
|
-
return clone;
|
|
13
|
-
}, "copyRegExpLoose");
|
|
14
|
-
const copyRegExpStrict = /* @__PURE__ */ __name((regExp, state) => {
|
|
15
|
-
const clone = new RegExp(regExp.source, regExp.flags);
|
|
16
|
-
return copyOwnProperties(regExp, clone, state);
|
|
17
|
-
}, "copyRegExpStrict");
|
|
18
|
-
|
|
19
|
-
exports.copyRegExpLoose = copyRegExpLoose;
|
|
20
|
-
exports.copyRegExpStrict = copyRegExpStrict;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import copyOwnProperties from './copyOwnProperties-FDDRgAnK.mjs';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const copyRegExpLoose = /* @__PURE__ */ __name((regExp) => {
|
|
6
|
-
const clone = new RegExp(regExp.source, regExp.flags);
|
|
7
|
-
clone.lastIndex = regExp.lastIndex;
|
|
8
|
-
return clone;
|
|
9
|
-
}, "copyRegExpLoose");
|
|
10
|
-
const copyRegExpStrict = /* @__PURE__ */ __name((regExp, state) => {
|
|
11
|
-
const clone = new RegExp(regExp.source, regExp.flags);
|
|
12
|
-
return copyOwnProperties(regExp, clone, state);
|
|
13
|
-
}, "copyRegExpStrict");
|
|
14
|
-
|
|
15
|
-
export { copyRegExpLoose, copyRegExpStrict };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
-
|
|
5
|
-
const copyOwnProperties = require('./copyOwnProperties-NdANNH2P.cjs');
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
-
const copySetLoose = /* @__PURE__ */ __name((set, state) => {
|
|
10
|
-
const clone = /* @__PURE__ */ new Set();
|
|
11
|
-
state.cache.set(set, clone);
|
|
12
|
-
set.forEach((value) => {
|
|
13
|
-
clone.add(state.clone(value, state));
|
|
14
|
-
});
|
|
15
|
-
return clone;
|
|
16
|
-
}, "copySetLoose");
|
|
17
|
-
const copySetStrict = /* @__PURE__ */ __name((set, state) => copyOwnProperties(set, copySetLoose(set, state), state), "copySetStrict");
|
|
18
|
-
|
|
19
|
-
exports.copySetLoose = copySetLoose;
|
|
20
|
-
exports.copySetStrict = copySetStrict;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import copyOwnProperties from './copyOwnProperties-FDDRgAnK.mjs';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const copySetLoose = /* @__PURE__ */ __name((set, state) => {
|
|
6
|
-
const clone = /* @__PURE__ */ new Set();
|
|
7
|
-
state.cache.set(set, clone);
|
|
8
|
-
set.forEach((value) => {
|
|
9
|
-
clone.add(state.clone(value, state));
|
|
10
|
-
});
|
|
11
|
-
return clone;
|
|
12
|
-
}, "copySetLoose");
|
|
13
|
-
const copySetStrict = /* @__PURE__ */ __name((set, state) => copyOwnProperties(set, copySetLoose(set, state), state), "copySetStrict");
|
|
14
|
-
|
|
15
|
-
export { copySetLoose, copySetStrict };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const getCleanClone = /* @__PURE__ */ __name((input) => {
|
|
6
|
-
if (!input) {
|
|
7
|
-
return /* @__PURE__ */ Object.create(null);
|
|
8
|
-
}
|
|
9
|
-
const Constructor = input.constructor;
|
|
10
|
-
if (Constructor === Object) {
|
|
11
|
-
return input === Object.prototype ? {} : Object.create(input);
|
|
12
|
-
}
|
|
13
|
-
if (~Function.prototype.toString.call(Constructor).indexOf("[native code]")) {
|
|
14
|
-
try {
|
|
15
|
-
return new Constructor();
|
|
16
|
-
} catch {
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return Object.create(input);
|
|
20
|
-
}, "getCleanClone");
|
|
21
|
-
|
|
22
|
-
module.exports = getCleanClone;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const getCleanClone = /* @__PURE__ */ __name((input) => {
|
|
4
|
-
if (!input) {
|
|
5
|
-
return /* @__PURE__ */ Object.create(null);
|
|
6
|
-
}
|
|
7
|
-
const Constructor = input.constructor;
|
|
8
|
-
if (Constructor === Object) {
|
|
9
|
-
return input === Object.prototype ? {} : Object.create(input);
|
|
10
|
-
}
|
|
11
|
-
if (~Function.prototype.toString.call(Constructor).indexOf("[native code]")) {
|
|
12
|
-
try {
|
|
13
|
-
return new Constructor();
|
|
14
|
-
} catch {
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return Object.create(input);
|
|
18
|
-
}, "getCleanClone");
|
|
19
|
-
|
|
20
|
-
export { getCleanClone as default };
|