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