@signaldb/core
Version:
SignalDB is a client-side database that provides a simple MongoDB-like interface to the data with first-class typescript support to achieve an optimistic UI. Data persistence can be achieved by using storage providers that store the data through a JSON in
18 lines (17 loc) • 820 B
TypeScript
/**
* Performs a deep clone of a value, supporting various types including arrays, objects,
* Maps, Sets, Dates, and RegExps. Functions are not supported and will throw an error.
* @template T - The type of the value to clone.
* @param value - The value to deep clone.
* @returns A deep copy of the provided value.
* @throws {Error} An error if the value is a function, as cloning functions is not supported.
*/
export declare function clone<T>(value: T): T;
/**
* Creates a deep clone of an object. Uses the `structuredClone` function if available,
* otherwise falls back to a manual deep clone implementation.
* @template T - The type of the object to clone.
* @param object - The object to deep clone.
* @returns A deep copy of the provided object.
*/
export default function deepClone<T>(object: T): T;