/ cloudformation-templates / node_modules / aws-cdk / node_modules / es5-ext / lib / Object / flatten.js
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)) { 10 forEach(value, self, this); 11 } else { 12 this[key] = value; 13 } 14 }; 15 16 module.exports = function (obj) { 17 var flattened = {}; 18 forEach(obj, process, flattened); 19 return flattened; 20 };