No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

hace 3 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # clone-deep [![NPM version](https://img.shields.io/npm/v/clone-deep.svg)](https://www.npmjs.com/package/clone-deep) [![Build Status](https://img.shields.io/travis/jonschlinkert/clone-deep.svg)](https://travis-ci.org/jonschlinkert/clone-deep)
  2. > Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.
  3. The `instanceClone` function is invoked to clone objects that are not "plain" objects (as defined by [](#isPlainObject)`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.
  4. ## Install
  5. Install with [npm](https://www.npmjs.com/)
  6. ```sh
  7. $ npm i clone-deep --save
  8. ```
  9. ## Usage
  10. ```js
  11. var cloneDeep = require('clone-deep');
  12. var obj = {a: 'b'};
  13. var arr = [obj];
  14. var copy = cloneDeep(arr);
  15. obj.c = 'd';
  16. console.log(copy);
  17. //=> [{a: 'b'}]
  18. console.log(arr);
  19. //=> [{a: 'b', c: 'd'}]
  20. ```
  21. ## Other object utils
  22. * [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… [more](https://www.npmjs.com/package/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep)
  23. * [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow)
  24. * [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep)
  25. * [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep)
  26. * [mixin-object](https://www.npmjs.com/package/mixin-object): Mixin the own and inherited properties of other objects onto the first object. Pass an… [more](https://www.npmjs.com/package/mixin-object) | [homepage](https://github.com/jonschlinkert/mixin-object)
  27. * [shallow-clone](https://www.npmjs.com/package/shallow-clone): Make a shallow clone of an object, array or primitive. | [homepage](https://github.com/jonschlinkert/shallow-clone)
  28. ## Running tests
  29. Install dev dependencies:
  30. ```sh
  31. $ npm i -d && npm test
  32. ```
  33. ## Contributing
  34. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/clone-deep/issues/new).
  35. ## Author
  36. **Jon Schlinkert**
  37. * [github/jonschlinkert](https://github.com/jonschlinkert)
  38. * [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
  39. Based on [mout's](https://github.com/mout/mout) implementation of deepClone.
  40. ## License
  41. Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert)
  42. Released under the MIT license.
  43. ***
  44. _This file was generated by [verb](https://github.com/verbose/verb) on December 23, 2015._
  45. <!-- deps:helper-lookup-deps -->