npm

Check out our latest tech talk, "JavaScript Supply Chain Security" presented by VP of Security, Adam Baldwin.Watch it here »

node-deepcopy

0.1.1 • Public • Published

node-deepcopy

Build Status Coverage Status npm version Dependency Status

https://www.npmjs.org/package/request-gb

deep copy for any JavaScript object.

Installation

    $ npm install node-deepcopy

Example

var deepcopy = require('node-deepcopy').deepcopy;
var toValue = function(obj){
    return isFunction(obj) || isRegExp(obj) ? obj.toString() : JSON.stringify(obj);
};
var foo = function () {
        this.c = 3;
        this.a = [
            {e: 2, f: 'good', g: [1, 2, 3]}
        ];
        this.b = 'b';
        this.d = function () {
            console.log("I'm foo.d.")
        };
    };
var source = new foo();
var cloned = deepcopy(source);
cloned2.a[0].f = '666';
console.log(cloned === source));

License

MIT

install

npm i node-deepcopy

Downloadsweekly downloads

15

version

0.1.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability