bunshin-clone 1.8.10 → 1.8.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 CHANGED
@@ -104,17 +104,8 @@ function cloneWithDescriptors(object, settings, refs) {
104
104
  return result;
105
105
  }
106
106
  function cloneArray(array, settings, refs) {
107
- if (isPrimitiveArray(array)) {
108
- const result2 = array.slice();
109
- refs.set(array, result2);
110
- return result2;
111
- }
112
- const { length } = array;
113
- const result = new Array(length);
107
+ const result = isPrimitiveArray(array) ? array.slice() : array.map((item) => clone(item, settings, refs));
114
108
  refs.set(array, result);
115
- for (let i = 0; i < length; i++) {
116
- result[i] = clone(array[i], settings, refs);
117
- }
118
109
  return result;
119
110
  }
120
111
  function clonePlainObject(object, settings, refs) {
package/dist/index.js CHANGED
@@ -102,17 +102,8 @@ function cloneWithDescriptors(object, settings, refs) {
102
102
  return result;
103
103
  }
104
104
  function cloneArray(array, settings, refs) {
105
- if (isPrimitiveArray(array)) {
106
- const result2 = array.slice();
107
- refs.set(array, result2);
108
- return result2;
109
- }
110
- const { length } = array;
111
- const result = new Array(length);
105
+ const result = isPrimitiveArray(array) ? array.slice() : array.map((item) => clone(item, settings, refs));
112
106
  refs.set(array, result);
113
- for (let i = 0; i < length; i++) {
114
- result[i] = clone(array[i], settings, refs);
115
- }
116
107
  return result;
117
108
  }
118
109
  function clonePlainObject(object, settings, refs) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunshin-clone",
3
- "version": "1.8.10",
3
+ "version": "1.8.11",
4
4
  "description": "High-performance deep clone utility with descriptor support",
5
5
  "keywords": [
6
6
  "array",