Travis build: 1951

This commit is contained in:
30secondsofcode
2018-04-12 18:45:32 +00:00
parent d5bd85bdca
commit bac7270495
14 changed files with 132 additions and 21 deletions

View File

@ -5,12 +5,14 @@ Replaces the names of multiple object keys with the values provided.
Use `Object.keys()` in combination with `Array.reduce()` and the spread operator (`...`) to get the object's keys and rename them according to `keysMap`.
```js
const renameKeys = (keysMap, obj) => Object
.keys(obj)
.reduce((acc, key) => ({
...acc,
...{ [keysMap[key] || key]: obj[key] }
}), {});
const renameKeys = (keysMap, obj) =>
Object.keys(obj).reduce(
(acc, key) => ({
...acc,
...{ [keysMap[key] || key]: obj[key] }
}),
{}
);
```
```js