Skip to content

iminside/js.clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install

npm install js.clone --save

Usage

import Clone from "js.clone";

var a, b, c;

a = {
	null:     null,
	boolean:  true,
	number:   1,
	string:   "string",
	regexp:   /regexp/,
	function: function(){},
	array:    ["array"],
	object:   {foo: "bar"}
}

b = Clone( a );

a == b // false

a.array.push( 1 );
a.array // > ["array", 1]
b.array // > ["array"]

// Circular links

a.circular = a;
a.circular === a          // > true
c = Clone( a );
c.circular === c          // > true
c.circular === a.circular // > false

About

Deep clone any object with circular references

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published