forked from github/fast-deep-copy
add readme
This commit is contained in:
parent
25e19bbf04
commit
eb98120866
23
readme.md
23
readme.md
@ -1,3 +1,22 @@
|
||||
```js
|
||||
import { deepCopy } from 'fast-deep-copy'
|
||||
# fast-deep-copy
|
||||
Only 20 lines code! no deps!
|
||||
|
||||
useage:
|
||||
```
|
||||
npm install -S fast-deep-copy
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
import { deepCopy } from 'fast-deep-copy'
|
||||
|
||||
let a = { dataA: 10, b: null };
|
||||
let b = { dataB: 20, a: null };
|
||||
a.b = b;
|
||||
b.a = a;
|
||||
|
||||
let newA = deepCopy(a);
|
||||
console.log(newA.dataA === 10); //true
|
||||
console.log(newA.b.dataB === 20); //true
|
||||
console.log(newA.b.a === newA); //true
|
||||
```
|
Loading…
Reference in New Issue
Block a user