bunshin-clone 1.0.3 → 1.0.4
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 +7 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -160,19 +160,19 @@ function cloneError(value, options, ref) {
|
|
|
160
160
|
function cloneWithDescriptors(node, options, ref) {
|
|
161
161
|
const result = Object.create(Object.getPrototypeOf(node));
|
|
162
162
|
ref.set(node, result);
|
|
163
|
-
const
|
|
164
|
-
const keys = Reflect.ownKeys(
|
|
163
|
+
const descs = Object.getOwnPropertyDescriptors(node);
|
|
164
|
+
const keys = Reflect.ownKeys(descs);
|
|
165
165
|
for (let i = 0, l = keys.length; i < l; i++) {
|
|
166
166
|
const key = keys[i];
|
|
167
167
|
if (isUnsafeKey(key)) {
|
|
168
168
|
continue;
|
|
169
169
|
}
|
|
170
|
-
const
|
|
171
|
-
if ("value" in
|
|
172
|
-
|
|
170
|
+
const desc = { ...descs[key] };
|
|
171
|
+
if ("value" in desc) {
|
|
172
|
+
desc.value = clone(desc.value, options, ref);
|
|
173
173
|
}
|
|
174
174
|
try {
|
|
175
|
-
Object.defineProperty(result, key,
|
|
175
|
+
Object.defineProperty(result, key, desc);
|
|
176
176
|
} catch (error) {
|
|
177
177
|
if (options.strictDescriptors) {
|
|
178
178
|
throw error;
|
|
@@ -195,7 +195,7 @@ function isUnsafeKey(key) {
|
|
|
195
195
|
* High-performance deep clone utility with descriptor support.
|
|
196
196
|
* Supports circular ref and complex built-in types.
|
|
197
197
|
*
|
|
198
|
-
* @version 1.0.
|
|
198
|
+
* @version 1.0.4
|
|
199
199
|
* @author Yusuke Kamiyamane
|
|
200
200
|
* @license MIT
|
|
201
201
|
* @copyright Copyright (c) 2026 Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -156,19 +156,19 @@ function cloneError(value, options, ref) {
|
|
|
156
156
|
function cloneWithDescriptors(node, options, ref) {
|
|
157
157
|
const result = Object.create(Object.getPrototypeOf(node));
|
|
158
158
|
ref.set(node, result);
|
|
159
|
-
const
|
|
160
|
-
const keys = Reflect.ownKeys(
|
|
159
|
+
const descs = Object.getOwnPropertyDescriptors(node);
|
|
160
|
+
const keys = Reflect.ownKeys(descs);
|
|
161
161
|
for (let i = 0, l = keys.length; i < l; i++) {
|
|
162
162
|
const key = keys[i];
|
|
163
163
|
if (isUnsafeKey(key)) {
|
|
164
164
|
continue;
|
|
165
165
|
}
|
|
166
|
-
const
|
|
167
|
-
if ("value" in
|
|
168
|
-
|
|
166
|
+
const desc = { ...descs[key] };
|
|
167
|
+
if ("value" in desc) {
|
|
168
|
+
desc.value = clone(desc.value, options, ref);
|
|
169
169
|
}
|
|
170
170
|
try {
|
|
171
|
-
Object.defineProperty(result, key,
|
|
171
|
+
Object.defineProperty(result, key, desc);
|
|
172
172
|
} catch (error) {
|
|
173
173
|
if (options.strictDescriptors) {
|
|
174
174
|
throw error;
|
|
@@ -191,7 +191,7 @@ function isUnsafeKey(key) {
|
|
|
191
191
|
* High-performance deep clone utility with descriptor support.
|
|
192
192
|
* Supports circular ref and complex built-in types.
|
|
193
193
|
*
|
|
194
|
-
* @version 1.0.
|
|
194
|
+
* @version 1.0.4
|
|
195
195
|
* @author Yusuke Kamiyamane
|
|
196
196
|
* @license MIT
|
|
197
197
|
* @copyright Copyright (c) 2026 Yusuke Kamiyamane
|