npm install up-clone
|2||downloads in the last month|
|Version||0.0.1 last updated 7 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