katoikia-app/web-ui/web-react/node_modules/es5-ext/object/flatten.js

17 lines
354 B
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
"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;
};