UNPKG

@tienedev/datype

Version:

Modern TypeScript utility library with pragmatic typing and zero dependencies

27 lines 809 B
/** * Creates a deep clone of the given value, recursively cloning nested objects and arrays. * Handles circular references and preserves object types. * * @template T - The type of the value to clone * @param value - The value to clone * @returns A deep clone of the input value * * @example * ```typescript * import { cloneDeep } from 'datype'; * * const original = { * name: 'John', * hobbies: ['reading', 'coding'], * address: { city: 'Paris', zip: '75001' } * }; * * const cloned = cloneDeep(original); * cloned.address.city = 'London'; * * console.log(original.address.city); // 'Paris' (unchanged) * console.log(cloned.address.city); // 'London' * ``` */ export declare function cloneDeep<T>(value: T, seen?: WeakMap<object, any>): T; //# sourceMappingURL=index.d.ts.map