bunshin-clone 1.5.1 → 1.5.3

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
@@ -23,7 +23,7 @@ import { bunshinClone } from 'https://esm.unpkg.com/bunshin-clone@<x.x.x>';
23
23
  ## 📦 APIs
24
24
 
25
25
  ```ts
26
- bunshinClone(source, options);
26
+ bunshinClone<T>(source, options);
27
27
  // => T
28
28
  //
29
29
  // source: T
package/dist/index.cjs CHANGED
@@ -10,9 +10,8 @@ function clone(source, settings, refs) {
10
10
  if (!isObject(source)) {
11
11
  return source;
12
12
  }
13
- const ref = refs.get(source);
14
- if (ref !== void 0) {
15
- return ref;
13
+ if (refs.has(source)) {
14
+ return refs.get(source);
16
15
  }
17
16
  if (settings.preserveDescriptors && isPlainObject(source)) {
18
17
  return cloneWithDescriptors(source, settings, refs);
@@ -124,9 +123,8 @@ function clone(source, settings, refs) {
124
123
  return source;
125
124
  }
126
125
  function cloneBuffer(buffer, refs) {
127
- const ref = refs.get(buffer);
128
- if (ref !== void 0) {
129
- return ref;
126
+ if (refs.has(buffer)) {
127
+ return refs.get(buffer);
130
128
  }
131
129
  const result = buffer.slice(0);
132
130
  refs.set(buffer, result);
package/dist/index.js CHANGED
@@ -8,9 +8,8 @@ function clone(source, settings, refs) {
8
8
  if (!isObject(source)) {
9
9
  return source;
10
10
  }
11
- const ref = refs.get(source);
12
- if (ref !== void 0) {
13
- return ref;
11
+ if (refs.has(source)) {
12
+ return refs.get(source);
14
13
  }
15
14
  if (settings.preserveDescriptors && isPlainObject(source)) {
16
15
  return cloneWithDescriptors(source, settings, refs);
@@ -122,9 +121,8 @@ function clone(source, settings, refs) {
122
121
  return source;
123
122
  }
124
123
  function cloneBuffer(buffer, refs) {
125
- const ref = refs.get(buffer);
126
- if (ref !== void 0) {
127
- return ref;
124
+ if (refs.has(buffer)) {
125
+ return refs.get(buffer);
128
126
  }
129
127
  const result = buffer.slice(0);
130
128
  refs.set(buffer, result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunshin-clone",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "High-performance deep clone utility with descriptor support",
5
5
  "keywords": [
6
6
  "array",