fast-deep-copy
Version:
20 lines code! Deep copy the given object considering circular structure
11 lines (10 loc) • 337 B
TypeScript
/**
* Deep copy the given object considering circular structure.
* This function caches all nested objects and its copies.
* If it detects circular structure, use cached copy to avoid infinite loop.
*
* @param {*} obj
* @param {Array<Object>} cache
* @return {*}
*/
export declare function deepCopy<T>(obj: T, cache?: any[]): T;