@visulima/deep-clone 3.0.3 → 3.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/CHANGELOG.md +16 -0
- package/dist/handler/copy-array-buffer.d.ts +3 -0
- package/dist/handler/copy-array.d.ts +6 -0
- package/dist/handler/copy-blob.d.ts +2 -0
- package/dist/handler/copy-data-view.d.ts +2 -0
- package/dist/handler/copy-date.d.ts +2 -0
- package/dist/handler/copy-error.d.ts +8 -0
- package/dist/handler/copy-map.d.ts +6 -0
- package/dist/handler/copy-object.d.ts +7 -0
- package/dist/handler/copy-regexp.d.ts +3 -0
- package/dist/handler/copy-set.d.ts +6 -0
- package/dist/handler.d.ts +10 -33
- package/dist/index.d.ts +10 -6
- package/dist/{packem_shared/types-_Qve7nv8.d.ts → types.d.ts} +4 -5
- package/dist/utils/copy-own-properties.d.ts +6 -0
- package/dist/utils/get-clean-clone.d.ts +5 -0
- package/dist/utils.d.ts +2 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## @visulima/deep-clone [3.0.5](https://github.com/visulima/visulima/compare/@visulima/deep-clone@3.0.4...@visulima/deep-clone@3.0.5) (2025-11-13)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* bump packem, to fix minified version of the code ([2a36ceb](https://github.com/visulima/visulima/commit/2a36ceb09251b0ca1178701a26547a871ed717a7))
|
|
6
|
+
|
|
7
|
+
## @visulima/deep-clone [3.0.4](https://github.com/visulima/visulima/compare/@visulima/deep-clone@3.0.3...@visulima/deep-clone@3.0.4) (2025-11-12)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update package configurations and TypeScript definitions ([b59aa59](https://github.com/visulima/visulima/commit/b59aa59dac1508216b944f4b917fb4a7ab1f70a4))
|
|
12
|
+
|
|
13
|
+
### Miscellaneous Chores
|
|
14
|
+
|
|
15
|
+
* Add jsr file to all packages for release ([#565](https://github.com/visulima/visulima/issues/565)) ([ec91652](https://github.com/visulima/visulima/commit/ec91652b4e4112adf14ba152c1239a7703ba425a))
|
|
16
|
+
|
|
1
17
|
## @visulima/deep-clone [3.0.3](https://github.com/visulima/visulima/compare/@visulima/deep-clone@3.0.2...@visulima/deep-clone@3.0.3) (2025-11-07)
|
|
2
18
|
|
|
3
19
|
### Bug Fixes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { State } from "../types.d.ts";
|
|
2
|
+
export declare const copyArrayLoose: <Value extends unknown[]>(array: Value, state: State) => Value;
|
|
3
|
+
/**
|
|
4
|
+
* Deeply copy the indexed values in the array, as well as any custom properties.
|
|
5
|
+
*/
|
|
6
|
+
export declare const copyArrayStrict: <Value extends unknown[]>(array: Value, state: State) => Value;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { State } from "../types.d.ts";
|
|
2
|
+
type ExtendedError = Error & {
|
|
3
|
+
code?: any;
|
|
4
|
+
errno?: any;
|
|
5
|
+
syscall?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const copyError: <Value extends EvalError | ExtendedError | RangeError | ReferenceError | SyntaxError | TypeError | URIError>(object: Value, state: State) => Value;
|
|
8
|
+
export default copyError;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { State } from "../types.d.ts";
|
|
2
|
+
export declare const copyMapLoose: <Value extends Map<unknown, unknown>>(map: Value, state: State) => Value;
|
|
3
|
+
/**
|
|
4
|
+
* Deeply copy the keys and values of the original, as well as any custom properties.
|
|
5
|
+
*/
|
|
6
|
+
export declare const copyMapStrict: <Value extends Map<unknown, unknown>>(map: Value, state: State) => Value;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { State } from "../types.d.ts";
|
|
2
|
+
export declare const copyObjectLoose: <Value extends Record<PropertyKey, unknown>>(object: Value, state: State) => Value;
|
|
3
|
+
/**
|
|
4
|
+
* Deeply copy the properties (keys and symbols) and values of the original, as well
|
|
5
|
+
* as any hidden or non-enumerable properties.
|
|
6
|
+
*/
|
|
7
|
+
export declare const copyObjectStrict: <Value extends Record<PropertyKey, unknown>>(object: Value, state: State) => Value;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { State } from "../types.d.ts";
|
|
2
|
+
export declare const copySetLoose: <Value extends Set<unknown>>(set: Value, state: State) => Value;
|
|
3
|
+
/**
|
|
4
|
+
* Deeply copy the values of the original, as well as any custom properties.
|
|
5
|
+
*/
|
|
6
|
+
export declare const copySetStrict: <Value extends Set<unknown>>(set: Value, state: State) => Value;
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,33 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
declare const copyDate: <Value extends Date>(date: Value) => Value;
|
|
13
|
-
|
|
14
|
-
type ExtendedError = Error & {
|
|
15
|
-
code?: any;
|
|
16
|
-
errno?: any;
|
|
17
|
-
syscall?: any;
|
|
18
|
-
};
|
|
19
|
-
declare const copyError: <Value extends EvalError | ExtendedError | RangeError | ReferenceError | SyntaxError | TypeError | URIError>(object: Value, state: State) => Value;
|
|
20
|
-
|
|
21
|
-
declare const copyMapLoose: <Value extends Map<unknown, unknown>>(map: Value, state: State) => Value;
|
|
22
|
-
declare const copyMapStrict: <Value extends Map<unknown, unknown>>(map: Value, state: State) => Value;
|
|
23
|
-
|
|
24
|
-
declare const copyObjectLoose: <Value extends Record<PropertyKey, unknown>>(object: Value, state: State) => Value;
|
|
25
|
-
declare const copyObjectStrict: <Value extends Record<PropertyKey, unknown>>(object: Value, state: State) => Value;
|
|
26
|
-
|
|
27
|
-
declare const copyRegExpLoose: <Value extends RegExp>(regExp: Value) => Value;
|
|
28
|
-
declare const copyRegExpStrict: <Value extends RegExp>(regExp: Value, state: State) => Value;
|
|
29
|
-
|
|
30
|
-
declare const copySetLoose: <Value extends Set<unknown>>(set: Value, state: State) => Value;
|
|
31
|
-
declare const copySetStrict: <Value extends Set<unknown>>(set: Value, state: State) => Value;
|
|
32
|
-
|
|
33
|
-
export { copyArrayBuffer, copyArrayLoose, copyArrayStrict, copyBlob, copyDataView, copyDate, copyError, copyMapLoose, copyMapStrict, copyObjectLoose, copyObjectStrict, copyRegExpLoose, copyRegExpStrict, copySetLoose, copySetStrict };
|
|
1
|
+
export { copyArrayLoose, copyArrayStrict } from "./handler/copy-array.d.ts";
|
|
2
|
+
export { default as copyArrayBuffer } from "./handler/copy-array-buffer.d.ts";
|
|
3
|
+
export { default as copyBlob } from "./handler/copy-blob.d.ts";
|
|
4
|
+
export { default as copyDataView } from "./handler/copy-data-view.d.ts";
|
|
5
|
+
export { default as copyDate } from "./handler/copy-date.d.ts";
|
|
6
|
+
export { default as copyError } from "./handler/copy-error.d.ts";
|
|
7
|
+
export { copyMapLoose, copyMapStrict } from "./handler/copy-map.d.ts";
|
|
8
|
+
export { copyObjectLoose, copyObjectStrict } from "./handler/copy-object.d.ts";
|
|
9
|
+
export { copyRegExpLoose, copyRegExpStrict } from "./handler/copy-regexp.d.ts";
|
|
10
|
+
export { copySetLoose, copySetStrict } from "./handler/copy-set.d.ts";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { S as State } from './packem_shared/types-_Qve7nv8.js';
|
|
3
|
-
|
|
1
|
+
import type { Options } from "./types.d.ts";
|
|
4
2
|
type DeepReadwrite<T> = T extends object | [] ? {
|
|
5
3
|
-readonly [P in keyof T]: DeepReadwrite<T[P]>;
|
|
6
4
|
} : T;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Function that creates a deep clone of an object or array.
|
|
7
|
+
* @template T - The type of the original data.
|
|
8
|
+
* @param originalData The original data to be cloned. It uses the generic parameter `T`.
|
|
9
|
+
* @param options Optional. The cloning options. Type of this parameter is `Options`.
|
|
10
|
+
* @returns The deep cloned data with its type as `DeepReadwrite<T>`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const deepClone: <T>(originalData: T, options?: Options) => DeepReadwrite<T>;
|
|
13
|
+
export type { Options, State } from "./types.d.ts";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
type InternalHandler<Value> = (value: Value, state: State) => Value;
|
|
2
|
-
interface State {
|
|
2
|
+
export interface State {
|
|
3
3
|
cache: WeakMap<any, unknown>;
|
|
4
4
|
clone: InternalHandler<unknown>;
|
|
5
5
|
}
|
|
6
|
-
type Options = {
|
|
6
|
+
export type Options = {
|
|
7
7
|
handler?: {
|
|
8
8
|
Array: InternalHandler<unknown[]>;
|
|
9
9
|
ArrayBuffer: InternalHandler<ArrayBuffer>;
|
|
@@ -26,6 +26,5 @@ type Options = {
|
|
|
26
26
|
};
|
|
27
27
|
strict?: boolean;
|
|
28
28
|
};
|
|
29
|
-
type TypedArray = BigInt64Array | BigUint64Array | Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
|
|
30
|
-
|
|
31
|
-
export type { Options as O, State as S, TypedArray as T };
|
|
29
|
+
export type TypedArray = BigInt64Array | BigUint64Array | Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
|
|
30
|
+
export {};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const copyOwnProperties: <Value>(value: Value, clone: Value, state: State) => Value;
|
|
4
|
-
|
|
5
|
-
declare const getCleanClone: (input: unknown) => any;
|
|
6
|
-
|
|
7
|
-
export { copyOwnProperties, getCleanClone };
|
|
1
|
+
export { default as copyOwnProperties } from "./utils/copy-own-properties.d.ts";
|
|
2
|
+
export { default as getCleanClone } from "./utils/get-clean-clone.d.ts";
|