]> gerrit.simantics Code Review - simantics/district.git/blob - es5-ext/object/flatten.js
Hide "enabled" column for non-component type tech type tables
[simantics/district.git] / es5-ext / object / flatten.js
1 'use strict';
2
3 var isPlainObject = require('./is-plain-object')
4   , forEach       = require('./for-each')
5
6   , process;
7
8 process = function self(value, key) {
9         if (isPlainObject(value)) forEach(value, self, this);
10         else this[key] = value;
11 };
12
13 module.exports = function (obj) {
14         var flattened = {};
15         forEach(obj, process, flattened);
16         return flattened;
17 };