mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
355 B
18 lines
355 B
10 years ago
|
'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;
|
||
|
};
|