kibana-riya
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
19 lines (16 loc) • 413 B
JavaScript
import _ from 'lodash';
export default function UniqLabelUtilService() {
/*
* Accepts an array of data objects and a formatter function.
* Returns a unique list of formatted labels (strings).
*/
return function (arr) {
if (!_.isArray(arr)) {
throw new TypeError('UniqLabelUtil expects an array of objects');
}
return _(arr)
.pluck('label')
.unique()
.value();
};
};