Travis build: 1581
This commit is contained in:
@ -11,12 +11,8 @@ You should always omit the second argument, `prefix`, unless you want every key
|
||||
```js
|
||||
const flattenObject = (obj, prefix = '') =>
|
||||
Object.keys(obj).reduce((acc, k) => {
|
||||
const pre = prefix.length ? (prefix + '.') : '';
|
||||
if (typeof obj[k] === 'object')
|
||||
Object.assign(
|
||||
acc,
|
||||
flattenObject(obj[k], pre + k)
|
||||
);
|
||||
const pre = prefix.length ? prefix + '.' : '';
|
||||
if (typeof obj[k] === 'object') Object.assign(acc, flattenObject(obj[k], pre + k));
|
||||
else acc[pre + k] = obj[k];
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
Reference in New Issue
Block a user