bloom-layout
Version:
layout components used in bloom packages
77 lines (46 loc) • 2.51 kB
Markdown
# clone-deep [](https://www.npmjs.com/package/clone-deep) [](https://npmjs.org/package/clone-deep) [](https://npmjs.org/package/clone-deep) [](https://travis-ci.org/jonschlinkert/clone-deep)
> Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save clone-deep
```
## Usage
```js
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'}]
```
## Heads up!
The `instanceClone` function is invoked to clone objects that are not "plain" objects (as defined by [isPlainObject](#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.
## Attribution
Based on [mout's](https://github.com/mout/mout) implementation of deepClone.
## About
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
### Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 19, 2017._