bunshin-clone 2.0.10 → 2.0.12
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/index.bundle.cjs +9 -13
- package/dist/index.bundle.js +9 -13
- package/dist/index.cjs +2 -10
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -10
- package/package.json +4 -4
package/dist/index.bundle.cjs
CHANGED
|
@@ -34,7 +34,7 @@ function cloneArrayBufferView(view, settings, refs) {
|
|
|
34
34
|
if (view instanceof DataView) {
|
|
35
35
|
const { buffer: buffer2, byteOffset: byteOffset2, byteLength } = view;
|
|
36
36
|
const result2 = new DataView(
|
|
37
|
-
|
|
37
|
+
clone(buffer2, settings, refs),
|
|
38
38
|
byteOffset2,
|
|
39
39
|
byteLength
|
|
40
40
|
);
|
|
@@ -49,18 +49,10 @@ function cloneArrayBufferView(view, settings, refs) {
|
|
|
49
49
|
}
|
|
50
50
|
const Ctor = view.constructor;
|
|
51
51
|
const { buffer, byteOffset, length } = view;
|
|
52
|
-
const result = new Ctor(
|
|
52
|
+
const result = new Ctor(clone(buffer, settings, refs), byteOffset, length);
|
|
53
53
|
refs.set(view, result);
|
|
54
54
|
return result;
|
|
55
55
|
}
|
|
56
|
-
function cloneBuffer(buffer, refs) {
|
|
57
|
-
if (refs.has(buffer)) {
|
|
58
|
-
return refs.get(buffer);
|
|
59
|
-
}
|
|
60
|
-
const result = buffer.slice(0);
|
|
61
|
-
refs.set(buffer, result);
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
56
|
|
|
65
57
|
// src/clone/blob.ts
|
|
66
58
|
function cloneBlob(blob, refs) {
|
|
@@ -146,7 +138,12 @@ function cloneMap(map, settings, refs) {
|
|
|
146
138
|
}
|
|
147
139
|
return result;
|
|
148
140
|
}
|
|
149
|
-
|
|
141
|
+
|
|
142
|
+
// node_modules/@y14e/own/dist/index.js
|
|
143
|
+
var {
|
|
144
|
+
getOwnPropertyDescriptors: OWN_DESCS,
|
|
145
|
+
getOwnPropertySymbols: OWN_SYMBOL_KEYS
|
|
146
|
+
} = Object;
|
|
150
147
|
function OWN_ENUM_KEYS(object) {
|
|
151
148
|
return [...OWN_ENUM_STRING_KEYS(object), ...OWN_ENUM_SYMBOL_KEYS(object)];
|
|
152
149
|
}
|
|
@@ -174,9 +171,8 @@ function OWN_STRING_KEYS(object) {
|
|
|
174
171
|
}
|
|
175
172
|
return keys;
|
|
176
173
|
}
|
|
177
|
-
var OWN_SYMBOL_KEYS = Object.getOwnPropertySymbols;
|
|
178
174
|
function isUnsafeKey(key) {
|
|
179
|
-
return
|
|
175
|
+
return key === "__proto__" || key === "prototype" || key === "constructor";
|
|
180
176
|
}
|
|
181
177
|
|
|
182
178
|
// src/clone/plain-object.ts
|
package/dist/index.bundle.js
CHANGED
|
@@ -32,7 +32,7 @@ function cloneArrayBufferView(view, settings, refs) {
|
|
|
32
32
|
if (view instanceof DataView) {
|
|
33
33
|
const { buffer: buffer2, byteOffset: byteOffset2, byteLength } = view;
|
|
34
34
|
const result2 = new DataView(
|
|
35
|
-
|
|
35
|
+
clone(buffer2, settings, refs),
|
|
36
36
|
byteOffset2,
|
|
37
37
|
byteLength
|
|
38
38
|
);
|
|
@@ -47,18 +47,10 @@ function cloneArrayBufferView(view, settings, refs) {
|
|
|
47
47
|
}
|
|
48
48
|
const Ctor = view.constructor;
|
|
49
49
|
const { buffer, byteOffset, length } = view;
|
|
50
|
-
const result = new Ctor(
|
|
50
|
+
const result = new Ctor(clone(buffer, settings, refs), byteOffset, length);
|
|
51
51
|
refs.set(view, result);
|
|
52
52
|
return result;
|
|
53
53
|
}
|
|
54
|
-
function cloneBuffer(buffer, refs) {
|
|
55
|
-
if (refs.has(buffer)) {
|
|
56
|
-
return refs.get(buffer);
|
|
57
|
-
}
|
|
58
|
-
const result = buffer.slice(0);
|
|
59
|
-
refs.set(buffer, result);
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
54
|
|
|
63
55
|
// src/clone/blob.ts
|
|
64
56
|
function cloneBlob(blob, refs) {
|
|
@@ -144,7 +136,12 @@ function cloneMap(map, settings, refs) {
|
|
|
144
136
|
}
|
|
145
137
|
return result;
|
|
146
138
|
}
|
|
147
|
-
|
|
139
|
+
|
|
140
|
+
// node_modules/@y14e/own/dist/index.js
|
|
141
|
+
var {
|
|
142
|
+
getOwnPropertyDescriptors: OWN_DESCS,
|
|
143
|
+
getOwnPropertySymbols: OWN_SYMBOL_KEYS
|
|
144
|
+
} = Object;
|
|
148
145
|
function OWN_ENUM_KEYS(object) {
|
|
149
146
|
return [...OWN_ENUM_STRING_KEYS(object), ...OWN_ENUM_SYMBOL_KEYS(object)];
|
|
150
147
|
}
|
|
@@ -172,9 +169,8 @@ function OWN_STRING_KEYS(object) {
|
|
|
172
169
|
}
|
|
173
170
|
return keys;
|
|
174
171
|
}
|
|
175
|
-
var OWN_SYMBOL_KEYS = Object.getOwnPropertySymbols;
|
|
176
172
|
function isUnsafeKey(key) {
|
|
177
|
-
return
|
|
173
|
+
return key === "__proto__" || key === "prototype" || key === "constructor";
|
|
178
174
|
}
|
|
179
175
|
|
|
180
176
|
// src/clone/plain-object.ts
|
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,7 @@ function cloneArrayBufferView(view, settings, refs) {
|
|
|
36
36
|
if (view instanceof DataView) {
|
|
37
37
|
const { buffer: buffer2, byteOffset: byteOffset2, byteLength } = view;
|
|
38
38
|
const result2 = new DataView(
|
|
39
|
-
|
|
39
|
+
clone(buffer2, settings, refs),
|
|
40
40
|
byteOffset2,
|
|
41
41
|
byteLength
|
|
42
42
|
);
|
|
@@ -51,18 +51,10 @@ function cloneArrayBufferView(view, settings, refs) {
|
|
|
51
51
|
}
|
|
52
52
|
const Ctor = view.constructor;
|
|
53
53
|
const { buffer, byteOffset, length } = view;
|
|
54
|
-
const result = new Ctor(
|
|
54
|
+
const result = new Ctor(clone(buffer, settings, refs), byteOffset, length);
|
|
55
55
|
refs.set(view, result);
|
|
56
56
|
return result;
|
|
57
57
|
}
|
|
58
|
-
function cloneBuffer(buffer, refs) {
|
|
59
|
-
if (refs.has(buffer)) {
|
|
60
|
-
return refs.get(buffer);
|
|
61
|
-
}
|
|
62
|
-
const result = buffer.slice(0);
|
|
63
|
-
refs.set(buffer, result);
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
66
58
|
|
|
67
59
|
// src/clone/blob.ts
|
|
68
60
|
function cloneBlob(blob, refs) {
|
package/dist/index.d.cts
CHANGED
|
@@ -7,8 +7,8 @@ interface BunshinCloneOptions {
|
|
|
7
7
|
}
|
|
8
8
|
type PlainObject = Record<PropertyKey, unknown>;
|
|
9
9
|
|
|
10
|
-
type
|
|
11
|
-
declare function isPrimitiveArray(array:
|
|
10
|
+
type ReadonlyArray_ = ReadonlyArray<unknown>;
|
|
11
|
+
declare function isPrimitiveArray(array: ReadonlyArray_): boolean;
|
|
12
12
|
|
|
13
13
|
declare function isObject(value: unknown): value is object;
|
|
14
14
|
declare function isPlainObject(value: unknown): value is PlainObject;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ interface BunshinCloneOptions {
|
|
|
7
7
|
}
|
|
8
8
|
type PlainObject = Record<PropertyKey, unknown>;
|
|
9
9
|
|
|
10
|
-
type
|
|
11
|
-
declare function isPrimitiveArray(array:
|
|
10
|
+
type ReadonlyArray_ = ReadonlyArray<unknown>;
|
|
11
|
+
declare function isPrimitiveArray(array: ReadonlyArray_): boolean;
|
|
12
12
|
|
|
13
13
|
declare function isObject(value: unknown): value is object;
|
|
14
14
|
declare function isPlainObject(value: unknown): value is PlainObject;
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ function cloneArrayBufferView(view, settings, refs) {
|
|
|
34
34
|
if (view instanceof DataView) {
|
|
35
35
|
const { buffer: buffer2, byteOffset: byteOffset2, byteLength } = view;
|
|
36
36
|
const result2 = new DataView(
|
|
37
|
-
|
|
37
|
+
clone(buffer2, settings, refs),
|
|
38
38
|
byteOffset2,
|
|
39
39
|
byteLength
|
|
40
40
|
);
|
|
@@ -49,18 +49,10 @@ function cloneArrayBufferView(view, settings, refs) {
|
|
|
49
49
|
}
|
|
50
50
|
const Ctor = view.constructor;
|
|
51
51
|
const { buffer, byteOffset, length } = view;
|
|
52
|
-
const result = new Ctor(
|
|
52
|
+
const result = new Ctor(clone(buffer, settings, refs), byteOffset, length);
|
|
53
53
|
refs.set(view, result);
|
|
54
54
|
return result;
|
|
55
55
|
}
|
|
56
|
-
function cloneBuffer(buffer, refs) {
|
|
57
|
-
if (refs.has(buffer)) {
|
|
58
|
-
return refs.get(buffer);
|
|
59
|
-
}
|
|
60
|
-
const result = buffer.slice(0);
|
|
61
|
-
refs.set(buffer, result);
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
56
|
|
|
65
57
|
// src/clone/blob.ts
|
|
66
58
|
function cloneBlob(blob, refs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bunshin-clone",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.12",
|
|
4
4
|
"description": "High-performance deep clone utility with descriptor support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -68,9 +68,6 @@
|
|
|
68
68
|
"prepublishOnly": "npm run build",
|
|
69
69
|
"test": "bun test"
|
|
70
70
|
},
|
|
71
|
-
"dependencies": {
|
|
72
|
-
"@y14e/own": "^1.0.5"
|
|
73
|
-
},
|
|
74
71
|
"devDependencies": {
|
|
75
72
|
"bun-types": "latest",
|
|
76
73
|
"tsup": "^8.0.0",
|
|
@@ -82,5 +79,8 @@
|
|
|
82
79
|
},
|
|
83
80
|
"allowScripts": {
|
|
84
81
|
"esbuild": true
|
|
82
|
+
},
|
|
83
|
+
"dependencies": {
|
|
84
|
+
"@y14e/own": "^1.0.6"
|
|
85
85
|
}
|
|
86
86
|
}
|