Deep clones all fields of the original objects even functions.
Install with npm:
$ npm install --save @techuila/deep-clone
Using import:
import deepClone from '@techuila/deep-clone';
Using require:
const deepClone = require('@techuila/deep-clone');
const obj = {
name: 'john',
obj: {
name: 'doe',
age: 1,
isMarried: true,
children: [{ name: 'child 1' }, { name: 'child 2' }, { name: 'child 3' }],
},
new: {
name: 'hello',
children: [{ name: 'child 1' }, { name: 'child 2' }, { name: 'child 3' }],
},
};
const copy_object = deepClone(obj);
Axl Cuyugan
Released under the ISC License.