Flatten nested javascript objects into a single-depth object.
$ npm install flatify-obj
const flatifyObject = require('flatify-obj');
flatifyObject({foo: {bar: {unicorn: 'π¦'}}})
//=> { 'foo.bar.unicorn': 'π¦' }
flatifyObject({foo: {unicorn: 'π¦'}, bar: 'unicorn'}, {onlyLeaves: true});
//=> {unicorn: 'π¦', bar: 'unicorn'}
Type: object
Object to flatten
Type: boolean
Default: false
Removes the parent property and only returns the leaf nodes of the object
MIT Β© Rocktim Saikia