bunshin-clone 1.0.9 → 1.0.11
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 -11
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -149,11 +149,17 @@ function cloneError(value, options, ref) {
|
|
|
149
149
|
result.name = name;
|
|
150
150
|
}
|
|
151
151
|
ref.set(value, result);
|
|
152
|
+
if (value.stack) {
|
|
153
|
+
try {
|
|
154
|
+
result.stack = value.stack;
|
|
155
|
+
} catch {
|
|
156
|
+
}
|
|
157
|
+
}
|
|
152
158
|
if ("cause" in value && value.cause !== void 0) {
|
|
153
159
|
result.cause = clone(value.cause, options, ref);
|
|
154
160
|
}
|
|
155
|
-
|
|
156
|
-
result
|
|
161
|
+
for (const key of Object.keys(value)) {
|
|
162
|
+
result[key] = clone(value[key], options, ref);
|
|
157
163
|
}
|
|
158
164
|
return result;
|
|
159
165
|
}
|
|
@@ -162,9 +168,6 @@ function cloneWithDescriptors(node, options, ref) {
|
|
|
162
168
|
ref.set(node, result);
|
|
163
169
|
const descs = Object.getOwnPropertyDescriptors(node);
|
|
164
170
|
forEachOwnKey(descs, (key) => {
|
|
165
|
-
if (!key) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
171
|
if (isUnsafeKey(key)) {
|
|
169
172
|
return;
|
|
170
173
|
}
|
|
@@ -188,11 +191,7 @@ function forEachOwnKey(object, callback) {
|
|
|
188
191
|
}
|
|
189
192
|
const symbols = Object.getOwnPropertySymbols(object);
|
|
190
193
|
for (let i = 0, l = symbols.length; i < l; i++) {
|
|
191
|
-
|
|
192
|
-
if (!symbol) {
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
callback(symbol);
|
|
194
|
+
callback(symbols[i]);
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
197
|
function isObject(value) {
|
|
@@ -213,7 +212,7 @@ function isUnsafeKey(key) {
|
|
|
213
212
|
* High-performance deep clone utility with descriptor support.
|
|
214
213
|
* Supports circular ref and complex built-in types.
|
|
215
214
|
*
|
|
216
|
-
* @version 1.0.
|
|
215
|
+
* @version 1.0.11
|
|
217
216
|
* @author Yusuke Kamiyamane
|
|
218
217
|
* @license MIT
|
|
219
218
|
* @copyright Copyright (c) 2026 Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -147,11 +147,17 @@ function cloneError(value, options, ref) {
|
|
|
147
147
|
result.name = name;
|
|
148
148
|
}
|
|
149
149
|
ref.set(value, result);
|
|
150
|
+
if (value.stack) {
|
|
151
|
+
try {
|
|
152
|
+
result.stack = value.stack;
|
|
153
|
+
} catch {
|
|
154
|
+
}
|
|
155
|
+
}
|
|
150
156
|
if ("cause" in value && value.cause !== void 0) {
|
|
151
157
|
result.cause = clone(value.cause, options, ref);
|
|
152
158
|
}
|
|
153
|
-
|
|
154
|
-
result
|
|
159
|
+
for (const key of Object.keys(value)) {
|
|
160
|
+
result[key] = clone(value[key], options, ref);
|
|
155
161
|
}
|
|
156
162
|
return result;
|
|
157
163
|
}
|
|
@@ -160,9 +166,6 @@ function cloneWithDescriptors(node, options, ref) {
|
|
|
160
166
|
ref.set(node, result);
|
|
161
167
|
const descs = Object.getOwnPropertyDescriptors(node);
|
|
162
168
|
forEachOwnKey(descs, (key) => {
|
|
163
|
-
if (!key) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
169
|
if (isUnsafeKey(key)) {
|
|
167
170
|
return;
|
|
168
171
|
}
|
|
@@ -186,11 +189,7 @@ function forEachOwnKey(object, callback) {
|
|
|
186
189
|
}
|
|
187
190
|
const symbols = Object.getOwnPropertySymbols(object);
|
|
188
191
|
for (let i = 0, l = symbols.length; i < l; i++) {
|
|
189
|
-
|
|
190
|
-
if (!symbol) {
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
callback(symbol);
|
|
192
|
+
callback(symbols[i]);
|
|
194
193
|
}
|
|
195
194
|
}
|
|
196
195
|
function isObject(value) {
|
|
@@ -211,7 +210,7 @@ function isUnsafeKey(key) {
|
|
|
211
210
|
* High-performance deep clone utility with descriptor support.
|
|
212
211
|
* Supports circular ref and complex built-in types.
|
|
213
212
|
*
|
|
214
|
-
* @version 1.0.
|
|
213
|
+
* @version 1.0.11
|
|
215
214
|
* @author Yusuke Kamiyamane
|
|
216
215
|
* @license MIT
|
|
217
216
|
* @copyright Copyright (c) 2026 Yusuke Kamiyamane
|