shallow-clone
Make a shallow clone of an object, array or primitive.
Install
Install with npm
Usage
shallow clones arrays
The array itself is cloned, but not the elements of the array. So any objects in the array will still not be cloned (e.g. they will be the same object as in the orginal array).
returns primitives as-is
shallow clone a regex
shallow clone an object
Related projects
assign-deep: Deeply assign the enumerable properties of source objects to a destination object.
clone-deep: Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.
extend-shallow: Extend an object with the properties of additional objects. node.js/javascript util.
is-plain-object: Returns true if an object was created by the
Object
constructor.mixin-object: Mixin the own and inherited properties of other objects onto the first object. Pass an… more
mixin-deep: Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.
Running tests
Install dev dependencies:
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on August 10, 2015.
Last updated