An utility to deep copy ES6 types. Following are the supported types,
- Json Object
- Number
- String
- Boolean
- Map
- Set
- Date
- Array
All other types will be shallow copied.
- Clone the repo
- run the test using "npm test"
- Node 5.4.0 and greater
Install esclone using,
npm install --savedev esclone
To use in any file add import for esclone as below,
import esclone from "esclone";
And then use in code as below,
const rockysGrandFather = {
name: "Rockys grand father",
father: "Don't know :("
};
const rockysFather = {
name: "Rockys Father",
father: rockysGrandFather
};
const rocky = {
name: "Rocky",
father: rockysFather
};
const rockyClone = esclone(rocky);
Install esclone using,
npm install --savedev esclone
And then use in code as below,
var esclone = require("esclone")
var foo = new String("abcd")
var fooClone = esclone.default(foo)
console.log(fooClone)
console.log(foo === fooClone)
npm install --savedev esclone
npm run test
/node_modules/eslint/bin/eslint.js --ext .js ./src
/node_modules/eslint/bin/eslint.js --ext .js ./src --fix
Tushar Dhole
This project is licensed under the MIT License - see the LICENSE.md file for details