UNPKG

charlike

Version:

Small, fast, simple and streaming project scaffolder for myself, but not only. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options

18 lines (13 loc) 355 B
'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; };