@spalger/kibana
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
23 lines (19 loc) • 588 B
JavaScript
define(function (require) {
return function GetSeriesUtilService() {
var _ = require('lodash');
/*
* Accepts a Kibana data object with a rows or columns key
* and returns an array of flattened series values.
*/
return function (obj) {
if (!_.isObject(obj) || !obj.rows && !obj.columns) {
throw new TypeError('GetSeriesUtilService expects an object with either a rows or columns key');
}
obj = obj.rows ? obj.rows : obj.columns;
return _.chain(obj)
.pluck('series')
.flattenDeep()
.value();
};
};
});