JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 21934250
  • Score
    100M100P100Q226266F
  • License MIT

Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.

Package Exports

  • clone-deep

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (clone-deep) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

clone-deep NPM version Build Status

Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.

The instanceClone function is invoked to clone objects that are not "plain" objects (as defined by isPlainObject) if it is provided. If instanceClone is not specified, it will not attempt to clone non-plain objects, and will copy the object reference.

Install

Install with npm

$ npm i clone-deep --save

Usage

var cloneDeep = require('clone-deep');

var obj = {a: 'b'};
var arr = [obj];

var copy = cloneDeep(arr);
obj.c = 'd';

console.log(copy);
//=> [{a: 'b'}]

console.log(arr);
//=> [{a: 'b', c: 'd'}]

Other object utils

  • assign-deep: Deeply assign the enumerable properties of source objects to a destination object.
  • extend-shallow: Extend an object with the properties of additional objects. node.js/javascript util.
  • merge-deep: Recursively merge values in a javascript object.
  • mixin-deep: Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.
  • mixin-object: Mixin the own and inherited properties of other objects onto the first object. Pass an… more
  • shallow-clone: Make a shallow clone of an object, array or primitive.

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

Based on mout's implementation of deepClone.

License

Copyright © 2014-2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on August 10, 2015.