source: trip-planner-front/node_modules/clone-deep/README.md@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.2 KB
Line 
1# clone-deep [![NPM version](https://img.shields.io/npm/v/clone-deep.svg?style=flat)](https://www.npmjs.com/package/clone-deep) [![NPM monthly downloads](https://img.shields.io/npm/dm/clone-deep.svg?style=flat)](https://npmjs.org/package/clone-deep) [![NPM total downloads](https://img.shields.io/npm/dt/clone-deep.svg?style=flat)](https://npmjs.org/package/clone-deep) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/clone-deep.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/clone-deep)
2
3> Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.
4
5Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
6
7## Install
8
9Install with [npm](https://www.npmjs.com/):
10
11```sh
12$ npm install --save clone-deep
13```
14
15## Usage
16
17```js
18const cloneDeep = require('clone-deep');
19
20let obj = { a: 'b' };
21let arr = [obj];
22let copy = cloneDeep(arr);
23obj.c = 'd';
24
25console.log(copy);
26//=> [{ a: 'b' }]
27
28console.log(arr);
29//=> [{ a: 'b', c: 'd' }]
30```
31
32## Heads up!
33
34The last argument specifies whether or not to clone instances (objects that are from a custom class or are not created by the `Object` constructor. This value may be `true` or the function use for cloning instances.
35
36When an `instanceClone` function is provided, it will be invoked to clone objects that are not "plain" objects (as defined by [isPlainObject](#isPlainObject)`isPlainObject`). If `instanceClone` is not specified, this library will not attempt to clone non-plain objects, and will simply copy the object reference.
37
38## Attribution
39
40Initially based on [mout's](https://github.com/mout/mout) implementation of deepClone.
41
42## About
43
44<details>
45<summary><strong>Contributing</strong></summary>
46
47Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
48
49</details>
50
51<details>
52<summary><strong>Running Tests</strong></summary>
53
54Running 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:
55
56```sh
57$ npm install && npm test
58```
59
60</details>
61
62<details>
63<summary><strong>Building docs</strong></summary>
64
65_(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.)_
66
67To generate the readme, run the following command:
68
69```sh
70$ npm install -g verbose/verb#dev verb-generate-readme && verb
71```
72
73</details>
74
75### Related projects
76
77You might also be interested in these projects:
78
79* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
80* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
81* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
82* [shallow-clone](https://www.npmjs.com/package/shallow-clone): Creates a shallow clone of any JavaScript value. | [homepage](https://github.com/jonschlinkert/shallow-clone "Creates a shallow clone of any JavaScript value.")
83
84### Contributors
85
86| **Commits** | **Contributor** |
87| --- | --- |
88| 46 | [jonschlinkert](https://github.com/jonschlinkert) |
89| 2 | [yujunlong2000](https://github.com/yujunlong2000) |
90
91### Author
92
93**Jon Schlinkert**
94
95* [GitHub Profile](https://github.com/jonschlinkert)
96* [Twitter Profile](https://twitter.com/jonschlinkert)
97* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
98
99### License
100
101Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
102Released under the [MIT License](LICENSE).
103
104***
105
106_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on November 21, 2018._
Note: See TracBrowser for help on using the repository browser.