bunshin-clone 2.0.6 → 2.0.8

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.
@@ -153,18 +153,14 @@ function OWN_ENUM_KEYS(object) {
153
153
  function OWN_ENUM_STRING_KEYS(object) {
154
154
  const keys = Object.keys(object);
155
155
  for (const key of keys) {
156
- if (isUnsafeKey(key)) {
157
- keys.splice(keys.indexOf(key), 1);
158
- }
156
+ isUnsafeKey(key) && keys.splice(keys.indexOf(key), 1);
159
157
  }
160
158
  return keys;
161
159
  }
162
160
  function OWN_ENUM_SYMBOL_KEYS(object) {
163
161
  const keys = OWN_SYMBOL_KEYS(object);
164
162
  for (const key of keys) {
165
- if (!Object.prototype.propertyIsEnumerable.call(object, key)) {
166
- keys.splice(keys.indexOf(key), 1);
167
- }
163
+ !Object.prototype.propertyIsEnumerable.call(object, key) && keys.splice(keys.indexOf(key), 1);
168
164
  }
169
165
  return keys;
170
166
  }
@@ -174,9 +170,7 @@ function OWN_KEYS(object) {
174
170
  function OWN_STRING_KEYS(object) {
175
171
  const keys = Object.getOwnPropertyNames(object);
176
172
  for (const key of keys) {
177
- if (isUnsafeKey(key)) {
178
- keys.splice(keys.indexOf(key), 1);
179
- }
173
+ isUnsafeKey(key) && keys.splice(keys.indexOf(key), 1);
180
174
  }
181
175
  return keys;
182
176
  }
@@ -151,18 +151,14 @@ function OWN_ENUM_KEYS(object) {
151
151
  function OWN_ENUM_STRING_KEYS(object) {
152
152
  const keys = Object.keys(object);
153
153
  for (const key of keys) {
154
- if (isUnsafeKey(key)) {
155
- keys.splice(keys.indexOf(key), 1);
156
- }
154
+ isUnsafeKey(key) && keys.splice(keys.indexOf(key), 1);
157
155
  }
158
156
  return keys;
159
157
  }
160
158
  function OWN_ENUM_SYMBOL_KEYS(object) {
161
159
  const keys = OWN_SYMBOL_KEYS(object);
162
160
  for (const key of keys) {
163
- if (!Object.prototype.propertyIsEnumerable.call(object, key)) {
164
- keys.splice(keys.indexOf(key), 1);
165
- }
161
+ !Object.prototype.propertyIsEnumerable.call(object, key) && keys.splice(keys.indexOf(key), 1);
166
162
  }
167
163
  return keys;
168
164
  }
@@ -172,9 +168,7 @@ function OWN_KEYS(object) {
172
168
  function OWN_STRING_KEYS(object) {
173
169
  const keys = Object.getOwnPropertyNames(object);
174
170
  for (const key of keys) {
175
- if (isUnsafeKey(key)) {
176
- keys.splice(keys.indexOf(key), 1);
177
- }
171
+ isUnsafeKey(key) && keys.splice(keys.indexOf(key), 1);
178
172
  }
179
173
  return keys;
180
174
  }
package/dist/index.d.cts CHANGED
@@ -1,18 +1,19 @@
1
1
  type Refs = WeakMap<object, object>;
2
2
 
3
- interface BunshinCloneOptions {
3
+ interface Options {
4
4
  preserveBufferSharing: boolean;
5
5
  preserveDescriptors: boolean;
6
6
  preserveSymbolKeys: boolean;
7
7
  }
8
8
  type PlainObject = Record<PropertyKey, unknown>;
9
9
 
10
- declare function isPrimitiveArray(array: unknown[]): boolean;
10
+ type Array_ = unknown[];
11
+ declare function isPrimitiveArray(array: Array_): boolean;
11
12
 
12
13
  declare function isObject(value: unknown): value is object;
13
14
  declare function isPlainObject(value: unknown): value is PlainObject;
14
15
 
15
- declare function bunshinClone<T>(value: T, options?: Partial<BunshinCloneOptions>): T;
16
- declare function clone<T>(value: T, settings: BunshinCloneOptions, refs: Refs): T;
16
+ declare function bunshinClone<T>(value: T, options?: Partial<Options>): T;
17
+ declare function clone<T>(value: T, settings: Options, refs: Refs): T;
17
18
 
18
- export { type BunshinCloneOptions, type PlainObject, bunshinClone, clone, isObject, isPlainObject, isPrimitiveArray };
19
+ export { type Options as BunshinCloneOptions, type PlainObject, bunshinClone, clone, isObject, isPlainObject, isPrimitiveArray };
package/dist/index.d.ts CHANGED
@@ -1,18 +1,19 @@
1
1
  type Refs = WeakMap<object, object>;
2
2
 
3
- interface BunshinCloneOptions {
3
+ interface Options {
4
4
  preserveBufferSharing: boolean;
5
5
  preserveDescriptors: boolean;
6
6
  preserveSymbolKeys: boolean;
7
7
  }
8
8
  type PlainObject = Record<PropertyKey, unknown>;
9
9
 
10
- declare function isPrimitiveArray(array: unknown[]): boolean;
10
+ type Array_ = unknown[];
11
+ declare function isPrimitiveArray(array: Array_): boolean;
11
12
 
12
13
  declare function isObject(value: unknown): value is object;
13
14
  declare function isPlainObject(value: unknown): value is PlainObject;
14
15
 
15
- declare function bunshinClone<T>(value: T, options?: Partial<BunshinCloneOptions>): T;
16
- declare function clone<T>(value: T, settings: BunshinCloneOptions, refs: Refs): T;
16
+ declare function bunshinClone<T>(value: T, options?: Partial<Options>): T;
17
+ declare function clone<T>(value: T, settings: Options, refs: Refs): T;
17
18
 
18
- export { type BunshinCloneOptions, type PlainObject, bunshinClone, clone, isObject, isPlainObject, isPrimitiveArray };
19
+ export { type Options as BunshinCloneOptions, type PlainObject, bunshinClone, clone, isObject, isPlainObject, isPrimitiveArray };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunshin-clone",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "High-performance deep clone utility with descriptor support",
5
5
  "keywords": [
6
6
  "array",
@@ -69,7 +69,7 @@
69
69
  "test": "bun test"
70
70
  },
71
71
  "dependencies": {
72
- "@y14e/own": "^1.0.3"
72
+ "@y14e/own": "^1.0.5"
73
73
  },
74
74
  "devDependencies": {
75
75
  "bun-types": "latest",