bunshin-clone 1.0.4 → 1.0.5
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 +5 -4
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var EMPTY_OPTIONS = {};
|
|
7
7
|
var { hasOwnProperty: HAS_OWN } = Object.prototype;
|
|
8
8
|
var { toString: OBJECT_TO_STRING } = Object.prototype;
|
|
9
|
-
function bunshinClone(source, options
|
|
10
|
-
return clone(source, options ?? EMPTY_OPTIONS,
|
|
9
|
+
function bunshinClone(source, options) {
|
|
10
|
+
return clone(source, options ?? EMPTY_OPTIONS, /* @__PURE__ */ new WeakMap());
|
|
11
11
|
}
|
|
12
|
-
function clone(node, options, ref) {
|
|
12
|
+
function clone(node, options = EMPTY_OPTIONS, ref = /* @__PURE__ */ new WeakMap()) {
|
|
13
13
|
if (!isObject(node)) {
|
|
14
14
|
return node;
|
|
15
15
|
}
|
|
@@ -195,12 +195,13 @@ function isUnsafeKey(key) {
|
|
|
195
195
|
* High-performance deep clone utility with descriptor support.
|
|
196
196
|
* Supports circular ref and complex built-in types.
|
|
197
197
|
*
|
|
198
|
-
* @version 1.0.
|
|
198
|
+
* @version 1.0.5
|
|
199
199
|
* @author Yusuke Kamiyamane
|
|
200
200
|
* @license MIT
|
|
201
201
|
* @copyright Copyright (c) 2026 Yusuke Kamiyamane
|
|
202
202
|
* @see {@link https://github.com/y14e/bunshin-clone}
|
|
203
203
|
*/
|
|
204
204
|
|
|
205
|
+
exports.clone = clone;
|
|
205
206
|
exports.cloneWithDescriptors = cloneWithDescriptors;
|
|
206
207
|
exports.default = bunshinClone;
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* High-performance deep clone utility with descriptor support.
|
|
4
4
|
* Supports circular ref and complex built-in types.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.0.
|
|
6
|
+
* @version 1.0.5
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) 2026 Yusuke Kamiyamane
|
|
@@ -15,7 +15,8 @@ interface BunshinCloneOptions {
|
|
|
15
15
|
}
|
|
16
16
|
type Ref = WeakMap<object, unknown>;
|
|
17
17
|
type AnyObject = Record<PropertyKey, unknown>;
|
|
18
|
-
declare function bunshinClone(source:
|
|
18
|
+
declare function bunshinClone<T>(source: T, options?: BunshinCloneOptions): T;
|
|
19
|
+
declare function clone<T>(node: T, options?: BunshinCloneOptions, ref?: Ref): T;
|
|
19
20
|
declare function cloneWithDescriptors(node: AnyObject, options: BunshinCloneOptions, ref: Ref): AnyObject;
|
|
20
21
|
|
|
21
|
-
export { type BunshinCloneOptions, cloneWithDescriptors, bunshinClone as default };
|
|
22
|
+
export { type BunshinCloneOptions, clone, cloneWithDescriptors, bunshinClone as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* High-performance deep clone utility with descriptor support.
|
|
4
4
|
* Supports circular ref and complex built-in types.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.0.
|
|
6
|
+
* @version 1.0.5
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) 2026 Yusuke Kamiyamane
|
|
@@ -15,7 +15,8 @@ interface BunshinCloneOptions {
|
|
|
15
15
|
}
|
|
16
16
|
type Ref = WeakMap<object, unknown>;
|
|
17
17
|
type AnyObject = Record<PropertyKey, unknown>;
|
|
18
|
-
declare function bunshinClone(source:
|
|
18
|
+
declare function bunshinClone<T>(source: T, options?: BunshinCloneOptions): T;
|
|
19
|
+
declare function clone<T>(node: T, options?: BunshinCloneOptions, ref?: Ref): T;
|
|
19
20
|
declare function cloneWithDescriptors(node: AnyObject, options: BunshinCloneOptions, ref: Ref): AnyObject;
|
|
20
21
|
|
|
21
|
-
export { type BunshinCloneOptions, cloneWithDescriptors, bunshinClone as default };
|
|
22
|
+
export { type BunshinCloneOptions, clone, cloneWithDescriptors, bunshinClone as default };
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
var EMPTY_OPTIONS = {};
|
|
3
3
|
var { hasOwnProperty: HAS_OWN } = Object.prototype;
|
|
4
4
|
var { toString: OBJECT_TO_STRING } = Object.prototype;
|
|
5
|
-
function bunshinClone(source, options
|
|
6
|
-
return clone(source, options ?? EMPTY_OPTIONS,
|
|
5
|
+
function bunshinClone(source, options) {
|
|
6
|
+
return clone(source, options ?? EMPTY_OPTIONS, /* @__PURE__ */ new WeakMap());
|
|
7
7
|
}
|
|
8
|
-
function clone(node, options, ref) {
|
|
8
|
+
function clone(node, options = EMPTY_OPTIONS, ref = /* @__PURE__ */ new WeakMap()) {
|
|
9
9
|
if (!isObject(node)) {
|
|
10
10
|
return node;
|
|
11
11
|
}
|
|
@@ -191,11 +191,11 @@ function isUnsafeKey(key) {
|
|
|
191
191
|
* High-performance deep clone utility with descriptor support.
|
|
192
192
|
* Supports circular ref and complex built-in types.
|
|
193
193
|
*
|
|
194
|
-
* @version 1.0.
|
|
194
|
+
* @version 1.0.5
|
|
195
195
|
* @author Yusuke Kamiyamane
|
|
196
196
|
* @license MIT
|
|
197
197
|
* @copyright Copyright (c) 2026 Yusuke Kamiyamane
|
|
198
198
|
* @see {@link https://github.com/y14e/bunshin-clone}
|
|
199
199
|
*/
|
|
200
200
|
|
|
201
|
-
export { cloneWithDescriptors, bunshinClone as default };
|
|
201
|
+
export { clone, cloneWithDescriptors, bunshinClone as default };
|