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

26 lines (23 loc) 788 B
var _ = require('lodash'); var configFile = require('../../timelion.json'); module.exports = function () { function flattenWith(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; }; var timelionDefaults = flattenWith('.', configFile); return _.reduce(timelionDefaults, (result, value, key) => { result['timelion:' + key] = value; return result; }, {}); };