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) • 606 B
JavaScript
import _ from 'lodash';
import VislibComponentsLabelsFlattenSeriesProvider from './flatten_series';
export default function GetArrayUtilService(Private) {
const flattenSeries = Private(VislibComponentsLabelsFlattenSeriesProvider);
/*
* Accepts a Kibana data object and returns an array of values objects.
*/
return function (obj) {
if (!_.isObject(obj) || !obj.rows && !obj.columns && !obj.series) {
throw new TypeError('GetArrayUtilService expects an object with a series, rows, or columns key');
}
if (!obj.series) return flattenSeries(obj);
return obj.series;
};
};