compound-ex4
Version:
Compound-ex4 - MVC framework for NodeJS (ExpressJs 4 version), fork compoundjs(https://github.com/1602/compound)
18 lines (13 loc) • 355 B
JavaScript
;
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;
};