]> git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/vim-mode/node_modules/grim/node_modules/emissary/node_modules/es6-weak-map/node_modules/es5-ext/object/flatten.js
e8b40444a9469287160113beb8d5ba2df4655d47
[rbdr/dotfiles] / atom / packages / vim-mode / node_modules / grim / node_modules / emissary / node_modules / es6-weak-map / node_modules / 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 };