@visulima/deep-clone 3.0.3 → 3.0.4

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 CHANGED
@@ -1,3 +1,13 @@
1
+ ## @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)
2
+
3
+ ### Bug Fixes
4
+
5
+ * update package configurations and TypeScript definitions ([b59aa59](https://github.com/visulima/visulima/commit/b59aa59dac1508216b944f4b917fb4a7ab1f70a4))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * Add jsr file to all packages for release ([#565](https://github.com/visulima/visulima/issues/565)) ([ec91652](https://github.com/visulima/visulima/commit/ec91652b4e4112adf14ba152c1239a7703ba425a))
10
+
1
11
  ## @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
12
 
3
13
  ### Bug Fixes
@@ -0,0 +1,3 @@
1
+ import type { TypedArray } from "../types.d.ts";
2
+ declare const copyArrayBuffer: <Value extends ArrayBuffer | ArrayBufferView | Buffer | TypedArray>(arrayBuffer: Value) => Value;
3
+ export default copyArrayBuffer;
@@ -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,2 @@
1
+ declare const copyBlob: <Value extends Blob>(blob: Value) => Value;
2
+ export default copyBlob;
@@ -0,0 +1,2 @@
1
+ declare const copyDataView: <Value extends DataView>(dataView: Value) => Value;
2
+ export default copyDataView;
@@ -0,0 +1,2 @@
1
+ declare const copyDate: <Value extends Date>(date: Value) => Value;
2
+ export default copyDate;
@@ -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,3 @@
1
+ import type { State } from "../types.d.ts";
2
+ export declare const copyRegExpLoose: <Value extends RegExp>(regExp: Value) => Value;
3
+ export declare const copyRegExpStrict: <Value extends RegExp>(regExp: 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
- import { S as State, T as TypedArray } from './packem_shared/types-_Qve7nv8.js';
2
-
3
- declare const copyArrayLoose: <Value extends unknown[]>(array: Value, state: State) => Value;
4
- declare const copyArrayStrict: <Value extends unknown[]>(array: Value, state: State) => Value;
5
-
6
- declare const copyArrayBuffer: <Value extends ArrayBuffer | ArrayBufferView | Buffer | TypedArray>(arrayBuffer: Value) => Value;
7
-
8
- declare const copyBlob: <Value extends Blob>(blob: Value) => Value;
9
-
10
- declare const copyDataView: <Value extends DataView>(dataView: Value) => Value;
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 { O as Options } from './packem_shared/types-_Qve7nv8.js';
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
- declare const deepClone: <T>(originalData: T, options?: Options) => DeepReadwrite<T>;
8
-
9
- export { Options, deepClone };
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&lt;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 {};
@@ -0,0 +1,6 @@
1
+ import type { State } from "../types.d.ts";
2
+ /**
3
+ * Strict copy all properties contained on the object.
4
+ */
5
+ declare const copyOwnProperties: <Value>(value: Value, clone: Value, state: State) => Value;
6
+ export default copyOwnProperties;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Get an empty version of the object with the same prototype it has.
3
+ */
4
+ declare const getCleanClone: (input: unknown) => any;
5
+ export default getCleanClone;
package/dist/utils.d.ts CHANGED
@@ -1,7 +1,2 @@
1
- import { S as State } from './packem_shared/types-_Qve7nv8.js';
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/deep-clone",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "Fastest deep clone implementation.",
5
5
  "keywords": [
6
6
  "anolilab",