Travis build: 1822

This commit is contained in:
30secondsofcode
2020-03-16 17:14:46 +00:00
parent 8ab6a00668
commit 11b046af0a
12 changed files with 84 additions and 84 deletions

View File

@ -10,18 +10,17 @@ Use `Object.keys(obj)` to iterate over the object's keys.
Use `Array.prototype.reduce()` to create a new object with the same values and mapped keys using `fn`.
```js
const deepMapKeys = (obj, f) =>
Array.isArray(obj)
? obj.map(val => deepMapKeys(val, f))
: typeof obj === 'object'
? Object.keys(obj).reduce((acc, current) => {
? Object.keys(obj).reduce((acc, current) => {
const val = obj[current];
acc[f(current)] =
val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val);
return acc;
}, {})
: obj;
: obj;
```
```js