bunshin-clone 1.5.0 → 1.5.2
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 +4 -6
- package/dist/index.js +4 -6
- package/package.json +1 -1
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
|
-
|
|
14
|
-
|
|
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
|
-
|
|
128
|
-
|
|
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
|
-
|
|
12
|
-
|
|
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
|
-
|
|
126
|
-
|
|
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);
|