Travis build: 1213

This commit is contained in:
30secondsofcode
2018-01-12 12:48:24 +00:00
parent 0c650d8892
commit 7c1d156631
3 changed files with 64 additions and 6 deletions

View File

@ -10,9 +10,7 @@ const merge = (...objs) =>
[...objs].reduce(
(acc, obj) =>
Object.keys(obj).reduce((a, k) => {
acc[k] = acc.hasOwnProperty(k)
? [].concat(acc[k]).concat(obj[k])
: obj[k];
acc[k] = acc.hasOwnProperty(k) ? [].concat(acc[k]).concat(obj[k]) : obj[k];
return acc;
}, {}),
{}
@ -22,12 +20,12 @@ const merge = (...objs) =>
```js
const object = {
a: [{ x: 2 }, { y: 4 }],
b: 1,
b: 1
};
const other = {
a: { z: 3 },
b: [2, 3],
c: 'foo',
c: 'foo'
};
merge(object, other); // { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }
```