deep-cloning
v1.1.0
Published
Deep copy library for any kind of data structures in JavaScript!
Downloads
2
Maintainers
Readme
Deep-Cloning
A single method library for (deep) cloning any kind of data structure - like Object, Array, RegExp, Date as well as primitives.
Usage
Use the npm package deep-cloning
to your project:
npm install --save deep-cloning
// Import
const deepClone = require('deepClone');
let arr = [{ a: 0, b: 2}, { a: 3, b: 5}];
let clonedArr = deepClone(arr);
arr[0][a] = 6;
// => [{a: 6, b: 2}, { a: 3, b: 5}];
console.log(clonedArr);
// => [{a: 0, b: 2}, { a: 3, b: 5}]