Update shallow clone, tag, build

This commit is contained in:
Angelos Chalaris
2017-12-15 13:33:46 +02:00
parent 042260823b
commit 25984a700e
3 changed files with 21 additions and 4 deletions

View File

@ -1,9 +1,9 @@
### Shallow clone object
Use the object `...spread` operator to spread the properties of the target object into the clone.
Use `Object.assign()` and an empty object (`{}`) to create a shallo clone of the original.
```js
const shallowClone = obj => ({ ...obj });
const shallowClone = obj => Object.assign({}, obj);
/*
const a = { x: true, y: 1 };
const b = shallowClone(a);