lite-clone
v0.0.4
Published
A simple nodejs module for deep cloning objects.
Downloads
0
Readme
lite-clone
A simple nodejs module for deep cloning of objects.
Installation
npm install lite-clone
When should I use lite-clone?
You need to make a copy of your object by value, not by reference.
API
var clone = require('lite-clone');
clone(obj)
Copying object by value. obj - JavaScript object, that need to be copied.
var clone = require('lite-clone');
var obj = {a:3, b:2};
var newObj = clone(obj);
Examples
Copy object by value
var id = require('lite-clone');
var obj = {a:3, b:2};
var newObj = clone(obj);
obj.a = 7;
console.log(obj);
//{a:7, b:2}
console.log(newObj);
//{a:3, b:2}