Tumortisch-Dist/resources/app/node_modules/es5-ext/object/flatten.js

18 lines
355 B
JavaScript
Raw Permalink Normal View History

2021-06-15 16:00:08 +02: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;
};