bunshin-clone 1.2.8 → 1.2.10

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/README.md CHANGED
@@ -13,11 +13,11 @@ npm i bunshin-clone
13
13
  import { bunshinClone } from 'bunshin-clone';
14
14
 
15
15
  // CDNs
16
- import { bunshinClone } from 'https://esm.sh/bunshin-clone@1.2.8';
16
+ import { bunshinClone } from 'https://esm.sh/bunshin-clone@1.2.10';
17
17
  // or
18
- import { bunshinClone } from 'https://cdn.jsdelivr.net/npm/bunshin-clone@1.2.8/+esm';
18
+ import { bunshinClone } from 'https://cdn.jsdelivr.net/npm/bunshin-clone@1.2.10/+esm';
19
19
  // or
20
- import { bunshinClone } from 'https://esm.unpkg.com/bunshin-clone@1.2.8';
20
+ import { bunshinClone } from 'https://esm.unpkg.com/bunshin-clone@1.2.10';
21
21
  ```
22
22
 
23
23
  ## 📦 APIs
package/dist/index.cjs CHANGED
@@ -89,12 +89,10 @@ function clone(node, options, refs) {
89
89
  return result;
90
90
  }
91
91
  if (typeof ImageData !== "undefined" && node instanceof ImageData) {
92
- const result = new ImageData(
93
- new Uint8ClampedArray(node.data),
94
- node.width,
95
- node.height,
96
- { colorSpace: node.colorSpace }
97
- );
92
+ const { data, width, height, colorSpace } = node;
93
+ const result = new ImageData(new Uint8ClampedArray(data), width, height, {
94
+ colorSpace
95
+ });
98
96
  refs.set(node, result);
99
97
  return result;
100
98
  }
@@ -115,13 +113,12 @@ function clone(node, options, refs) {
115
113
  return node;
116
114
  }
117
115
  function cloneError(value, options, refs) {
116
+ const { name, message, cause, stack } = value;
118
117
  if (value instanceof DOMException) {
119
- const result2 = new DOMException(value.message, value.name);
118
+ const result2 = new DOMException(message, name);
120
119
  refs.set(value, result2);
121
120
  return result2;
122
121
  }
123
- const name = value.name || "Error";
124
- const message = value.message || "";
125
122
  let result;
126
123
  switch (name) {
127
124
  case "EvalError":
@@ -147,14 +144,14 @@ function cloneError(value, options, refs) {
147
144
  result.name = name;
148
145
  }
149
146
  refs.set(value, result);
150
- if (value.stack) {
147
+ if (stack) {
151
148
  try {
152
- result.stack = value.stack;
149
+ result.stack = stack;
153
150
  } catch {
154
151
  }
155
152
  }
156
- if ("cause" in value && value.cause !== void 0) {
157
- result.cause = clone(value.cause, options, refs);
153
+ if ("cause" in value && cause !== void 0) {
154
+ result.cause = clone(cause, options, refs);
158
155
  }
159
156
  for (const key of Object.keys(value)) {
160
157
  result[key] = clone(value[key], options, refs);
@@ -209,7 +206,7 @@ function isUnsafeKey(key) {
209
206
  * High-performance deep clone utility with descriptor support.
210
207
  * Handles circular ref and complex built-in types.
211
208
  *
212
- * @version 1.2.8
209
+ * @version 1.2.10
213
210
  * @author Yusuke Kamiyamane
214
211
  * @license MIT
215
212
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@
3
3
  * High-performance deep clone utility with descriptor support.
4
4
  * Handles circular ref and complex built-in types.
5
5
  *
6
- * @version 1.2.8
6
+ * @version 1.2.10
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * High-performance deep clone utility with descriptor support.
4
4
  * Handles circular ref and complex built-in types.
5
5
  *
6
- * @version 1.2.8
6
+ * @version 1.2.10
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -87,12 +87,10 @@ function clone(node, options, refs) {
87
87
  return result;
88
88
  }
89
89
  if (typeof ImageData !== "undefined" && node instanceof ImageData) {
90
- const result = new ImageData(
91
- new Uint8ClampedArray(node.data),
92
- node.width,
93
- node.height,
94
- { colorSpace: node.colorSpace }
95
- );
90
+ const { data, width, height, colorSpace } = node;
91
+ const result = new ImageData(new Uint8ClampedArray(data), width, height, {
92
+ colorSpace
93
+ });
96
94
  refs.set(node, result);
97
95
  return result;
98
96
  }
@@ -113,13 +111,12 @@ function clone(node, options, refs) {
113
111
  return node;
114
112
  }
115
113
  function cloneError(value, options, refs) {
114
+ const { name, message, cause, stack } = value;
116
115
  if (value instanceof DOMException) {
117
- const result2 = new DOMException(value.message, value.name);
116
+ const result2 = new DOMException(message, name);
118
117
  refs.set(value, result2);
119
118
  return result2;
120
119
  }
121
- const name = value.name || "Error";
122
- const message = value.message || "";
123
120
  let result;
124
121
  switch (name) {
125
122
  case "EvalError":
@@ -145,14 +142,14 @@ function cloneError(value, options, refs) {
145
142
  result.name = name;
146
143
  }
147
144
  refs.set(value, result);
148
- if (value.stack) {
145
+ if (stack) {
149
146
  try {
150
- result.stack = value.stack;
147
+ result.stack = stack;
151
148
  } catch {
152
149
  }
153
150
  }
154
- if ("cause" in value && value.cause !== void 0) {
155
- result.cause = clone(value.cause, options, refs);
151
+ if ("cause" in value && cause !== void 0) {
152
+ result.cause = clone(cause, options, refs);
156
153
  }
157
154
  for (const key of Object.keys(value)) {
158
155
  result[key] = clone(value[key], options, refs);
@@ -207,7 +204,7 @@ function isUnsafeKey(key) {
207
204
  * High-performance deep clone utility with descriptor support.
208
205
  * Handles circular ref and complex built-in types.
209
206
  *
210
- * @version 1.2.8
207
+ * @version 1.2.10
211
208
  * @author Yusuke Kamiyamane
212
209
  * @license MIT
213
210
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunshin-clone",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "description": "High-performance deep clone utility with descriptor support",
5
5
  "keywords": [
6
6
  "array",