bunshin-clone 1.5.7 → 1.6.0

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
@@ -2,7 +2,6 @@
2
2
 
3
3
  // src/index.ts
4
4
  var EMPTY_OPTIONS = {};
5
- var { hasOwnProperty: HAS_OWN } = Object.prototype;
6
5
  function bunshinClone(value, options = EMPTY_OPTIONS, refs = /* @__PURE__ */ new WeakMap()) {
7
6
  return clone(value, resolveOptions(options), refs);
8
7
  }
@@ -28,8 +27,8 @@ function clone(value, settings, refs) {
28
27
  if (isPlainObject(value)) {
29
28
  const result = Object.create(Object.getPrototypeOf(value));
30
29
  refs.set(value, result);
31
- for (const key in value) {
32
- if (HAS_OWN.call(value, key) && !isUnsafeKey(key)) {
30
+ for (const key of Reflect.ownKeys(value)) {
31
+ if (!isUnsafeKey(key) && Object.prototype.propertyIsEnumerable.call(value, key)) {
33
32
  result[key] = clone(value[key], settings, refs);
34
33
  }
35
34
  }
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // src/index.ts
2
2
  var EMPTY_OPTIONS = {};
3
- var { hasOwnProperty: HAS_OWN } = Object.prototype;
4
3
  function bunshinClone(value, options = EMPTY_OPTIONS, refs = /* @__PURE__ */ new WeakMap()) {
5
4
  return clone(value, resolveOptions(options), refs);
6
5
  }
@@ -26,8 +25,8 @@ function clone(value, settings, refs) {
26
25
  if (isPlainObject(value)) {
27
26
  const result = Object.create(Object.getPrototypeOf(value));
28
27
  refs.set(value, result);
29
- for (const key in value) {
30
- if (HAS_OWN.call(value, key) && !isUnsafeKey(key)) {
28
+ for (const key of Reflect.ownKeys(value)) {
29
+ if (!isUnsafeKey(key) && Object.prototype.propertyIsEnumerable.call(value, key)) {
31
30
  result[key] = clone(value[key], settings, refs);
32
31
  }
33
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunshin-clone",
3
- "version": "1.5.7",
3
+ "version": "1.6.0",
4
4
  "description": "High-performance deep clone utility with descriptor support",
5
5
  "keywords": [
6
6
  "array",