bunshin-clone 1.0.6 → 1.0.7
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.cjs +10 -8
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -70,17 +70,16 @@ function clone(node, options, ref) {
|
|
|
70
70
|
return result;
|
|
71
71
|
}
|
|
72
72
|
if (ArrayBuffer.isView(node)) {
|
|
73
|
+
const { buffer, byteOffset, byteLength } = node;
|
|
73
74
|
if (node instanceof DataView) {
|
|
74
|
-
const result = new DataView(
|
|
75
|
-
node.buffer.slice(0),
|
|
76
|
-
node.byteOffset,
|
|
77
|
-
node.byteLength
|
|
78
|
-
);
|
|
75
|
+
const result = new DataView(buffer.slice(0), byteOffset, byteLength);
|
|
79
76
|
ref.set(node, result);
|
|
80
77
|
return result;
|
|
81
78
|
} else {
|
|
82
79
|
const Ctor = node.constructor;
|
|
83
|
-
const result = new Ctor(
|
|
80
|
+
const result = new Ctor(
|
|
81
|
+
buffer.slice(byteOffset, byteOffset + byteLength)
|
|
82
|
+
);
|
|
84
83
|
ref.set(node, result);
|
|
85
84
|
return result;
|
|
86
85
|
}
|
|
@@ -142,7 +141,10 @@ function cloneError(value, options, ref) {
|
|
|
142
141
|
result.name = name;
|
|
143
142
|
}
|
|
144
143
|
if (!options.preserveDescriptors && "cause" in value) {
|
|
145
|
-
|
|
144
|
+
const cause = value.cause;
|
|
145
|
+
if (cause !== void 0) {
|
|
146
|
+
result.cause = clone(cause, options, ref);
|
|
147
|
+
}
|
|
146
148
|
}
|
|
147
149
|
if (value.stack) {
|
|
148
150
|
result.stack = value.stack;
|
|
@@ -193,7 +195,7 @@ function isUnsafeKey(key) {
|
|
|
193
195
|
* High-performance deep clone utility with descriptor support.
|
|
194
196
|
* Supports circular ref and complex built-in types.
|
|
195
197
|
*
|
|
196
|
-
* @version 1.0.
|
|
198
|
+
* @version 1.0.7
|
|
197
199
|
* @author Yusuke Kamiyamane
|
|
198
200
|
* @license MIT
|
|
199
201
|
* @copyright Copyright (c) 2026 Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -68,17 +68,16 @@ function clone(node, options, ref) {
|
|
|
68
68
|
return result;
|
|
69
69
|
}
|
|
70
70
|
if (ArrayBuffer.isView(node)) {
|
|
71
|
+
const { buffer, byteOffset, byteLength } = node;
|
|
71
72
|
if (node instanceof DataView) {
|
|
72
|
-
const result = new DataView(
|
|
73
|
-
node.buffer.slice(0),
|
|
74
|
-
node.byteOffset,
|
|
75
|
-
node.byteLength
|
|
76
|
-
);
|
|
73
|
+
const result = new DataView(buffer.slice(0), byteOffset, byteLength);
|
|
77
74
|
ref.set(node, result);
|
|
78
75
|
return result;
|
|
79
76
|
} else {
|
|
80
77
|
const Ctor = node.constructor;
|
|
81
|
-
const result = new Ctor(
|
|
78
|
+
const result = new Ctor(
|
|
79
|
+
buffer.slice(byteOffset, byteOffset + byteLength)
|
|
80
|
+
);
|
|
82
81
|
ref.set(node, result);
|
|
83
82
|
return result;
|
|
84
83
|
}
|
|
@@ -140,7 +139,10 @@ function cloneError(value, options, ref) {
|
|
|
140
139
|
result.name = name;
|
|
141
140
|
}
|
|
142
141
|
if (!options.preserveDescriptors && "cause" in value) {
|
|
143
|
-
|
|
142
|
+
const cause = value.cause;
|
|
143
|
+
if (cause !== void 0) {
|
|
144
|
+
result.cause = clone(cause, options, ref);
|
|
145
|
+
}
|
|
144
146
|
}
|
|
145
147
|
if (value.stack) {
|
|
146
148
|
result.stack = value.stack;
|
|
@@ -191,7 +193,7 @@ function isUnsafeKey(key) {
|
|
|
191
193
|
* High-performance deep clone utility with descriptor support.
|
|
192
194
|
* Supports circular ref and complex built-in types.
|
|
193
195
|
*
|
|
194
|
-
* @version 1.0.
|
|
196
|
+
* @version 1.0.7
|
|
195
197
|
* @author Yusuke Kamiyamane
|
|
196
198
|
* @license MIT
|
|
197
199
|
* @copyright Copyright (c) 2026 Yusuke Kamiyamane
|