Want to see pretty graphs? Log in now!
npm install up-clone
|1||downloads in the last week|
|5||downloads in the last month|
|Last Published By|
|Version||0.0.1 last updated 8 months ago|
|Keywords||clone, prototype, object, array, component|
Copies an object into a new one.
$ npm install up-clone
$ component install basicdays/clone
Array. Array contents are themselves cloned as well.
Will attempt to clone
Object. An object's properties are by default only shallowly copied. In order to copy
the all its prototypes into new objects with the same inheritance, set
deepCopy to true. If the base object
Object.prototype, the clone will reference
Object.prototype, not a clone of
Cloning classes ("typed" objects), especially with crazy inheritance structures, are not fully supported. You should use the object's originating constructor or just pass the reference to the same object.
RegExp, and DOM nodes will be passed back. Cloning functions is not supported due to the
complexities of inheritance and closures.
Cloning some of the built-in object "types" is untested and unsupported at this time (e.g.
Influenced by: https://github.com/component/clone