2017-08-14 05:01:11 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var isPlainObject = require("./is-plain-object")
|
|
|
|
, forEach = require("./for-each")
|
|
|
|
|
|
|
|
, process;
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
process = function self(value, key) {
|
2017-08-14 05:01:11 +02:00
|
|
|
if (isPlainObject(value)) forEach(value, self, this);
|
|
|
|
else this[key] = value;
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = function (obj) {
|
|
|
|
var flattened = {};
|
|
|
|
forEach(obj, process, flattened);
|
|
|
|
return flattened;
|
|
|
|
};
|