From eb98120866f6ea7a2e39745715cd9ff7b3fd4f6d Mon Sep 17 00:00:00 2001 From: zlh <625335512@qq.com> Date: Sat, 23 Sep 2017 15:31:37 +0800 Subject: [PATCH] add readme --- readme.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/readme.md b/readme.md index 25f7ef7..bbd1a78 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,22 @@ +# 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 ``` \ No newline at end of file