bunshin-clone 1.1.0 → 1.2.1
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 +4 -4
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
var EMPTY_OPTIONS = {};
|
|
5
5
|
var { hasOwnProperty: HAS_OWN } = Object.prototype;
|
|
6
|
-
function bunshinClone(source, options) {
|
|
7
|
-
return clone(source, options ?? EMPTY_OPTIONS, /* @__PURE__ */ new WeakMap());
|
|
6
|
+
function bunshinClone(source, options, refs) {
|
|
7
|
+
return clone(source, options ?? EMPTY_OPTIONS, refs ?? /* @__PURE__ */ new WeakMap());
|
|
8
8
|
}
|
|
9
9
|
function clone(node, options, refs) {
|
|
10
10
|
if (!isObject(node)) {
|
|
@@ -209,10 +209,10 @@ function isUnsafeKey(key) {
|
|
|
209
209
|
* High-performance deep clone utility with descriptor support.
|
|
210
210
|
* Handles circular ref and complex built-in types.
|
|
211
211
|
*
|
|
212
|
-
* @version 1.1
|
|
212
|
+
* @version 1.2.1
|
|
213
213
|
* @author Yusuke Kamiyamane
|
|
214
214
|
* @license MIT
|
|
215
|
-
* @copyright Copyright (c)
|
|
215
|
+
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
216
216
|
* @see {@link https://github.com/y14e/bunshin-clone}
|
|
217
217
|
*/
|
|
218
218
|
|
package/dist/index.d.cts
CHANGED
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
* High-performance deep clone utility with descriptor support.
|
|
4
4
|
* Handles circular ref and complex built-in types.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.1
|
|
6
|
+
* @version 1.2.1
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
|
-
* @copyright Copyright (c)
|
|
9
|
+
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
10
10
|
* @see {@link https://github.com/y14e/bunshin-clone}
|
|
11
11
|
*/
|
|
12
12
|
interface BunshinCloneOptions {
|
|
13
13
|
readonly preserveDescriptors?: boolean;
|
|
14
14
|
readonly strictDescriptors?: boolean;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
type Refs = WeakMap<object, unknown>;
|
|
17
|
+
declare function bunshinClone<T>(source: T, options?: BunshinCloneOptions, refs?: Refs): T;
|
|
17
18
|
|
|
18
19
|
export { type BunshinCloneOptions, bunshinClone as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
* High-performance deep clone utility with descriptor support.
|
|
4
4
|
* Handles circular ref and complex built-in types.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.1
|
|
6
|
+
* @version 1.2.1
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
|
-
* @copyright Copyright (c)
|
|
9
|
+
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
10
10
|
* @see {@link https://github.com/y14e/bunshin-clone}
|
|
11
11
|
*/
|
|
12
12
|
interface BunshinCloneOptions {
|
|
13
13
|
readonly preserveDescriptors?: boolean;
|
|
14
14
|
readonly strictDescriptors?: boolean;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
type Refs = WeakMap<object, unknown>;
|
|
17
|
+
declare function bunshinClone<T>(source: T, options?: BunshinCloneOptions, refs?: Refs): T;
|
|
17
18
|
|
|
18
19
|
export { type BunshinCloneOptions, bunshinClone as default };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
var EMPTY_OPTIONS = {};
|
|
3
3
|
var { hasOwnProperty: HAS_OWN } = Object.prototype;
|
|
4
|
-
function bunshinClone(source, options) {
|
|
5
|
-
return clone(source, options ?? EMPTY_OPTIONS, /* @__PURE__ */ new WeakMap());
|
|
4
|
+
function bunshinClone(source, options, refs) {
|
|
5
|
+
return clone(source, options ?? EMPTY_OPTIONS, refs ?? /* @__PURE__ */ new WeakMap());
|
|
6
6
|
}
|
|
7
7
|
function clone(node, options, refs) {
|
|
8
8
|
if (!isObject(node)) {
|
|
@@ -207,10 +207,10 @@ function isUnsafeKey(key) {
|
|
|
207
207
|
* High-performance deep clone utility with descriptor support.
|
|
208
208
|
* Handles circular ref and complex built-in types.
|
|
209
209
|
*
|
|
210
|
-
* @version 1.1
|
|
210
|
+
* @version 1.2.1
|
|
211
211
|
* @author Yusuke Kamiyamane
|
|
212
212
|
* @license MIT
|
|
213
|
-
* @copyright Copyright (c)
|
|
213
|
+
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
214
214
|
* @see {@link https://github.com/y14e/bunshin-clone}
|
|
215
215
|
*/
|
|
216
216
|
|