mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 02:42:48 +00:00
18 lines
355 B
JavaScript
18 lines
355 B
JavaScript
'use strict';
|
|
|
|
var isPlainObject = require('./is-plain-object')
|
|
, forEach = require('./for-each')
|
|
|
|
, process;
|
|
|
|
process = function self(value, key) {
|
|
if (isPlainObject(value)) forEach(value, self, this);
|
|
else this[key] = value;
|
|
};
|
|
|
|
module.exports = function (obj) {
|
|
var flattened = {};
|
|
forEach(obj, process, flattened);
|
|
return flattened;
|
|
};
|