UNPKG

kibana-123

Version:

Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic

18 lines (15 loc) 495 B
import _ from 'lodash'; module.exports = function (dot, nestedObj, flattenArrays) { let stack = []; // track key stack let flatObj = {}; (function flattenObj(obj) { _.keys(obj).forEach(function (key) { stack.push(key); if (!flattenArrays && _.isArray(obj[key])) flatObj[stack.join(dot)] = obj[key]; else if (_.isObject(obj[key])) flattenObj(obj[key]); else flatObj[stack.join(dot)] = obj[key]; stack.pop(); }); }(nestedObj)); return flatObj; };