js-clone-deep
JavaScript utility method for deep cloning Object and Array.
How to use
Get the npm module from here
const clone = ; // Source objectconst source = object: nested: deepNesting: key: 1 array: 1 2 4; // Clone the objectconst copy = ; console;// false console;// false
Developer warning
This method currently supports deep cloning of Object ({})
and Array ([])
only. Data structures such Set, WeakSets, Maps, WeakMaps, Streams, etc
will not be cloned.
Use this module considering the above limitation.