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
28 lines (23 loc) • 472 B
JavaScript
/**
* Lowercases input and replaces spaces with hyphens:
* e.g. 'GridView Example' -> 'gridview-example'
*/
function one(str) {
const parts = str
.toLowerCase()
.replace(/[-]+/g, ' ')
.replace(/[^\w^\s]+/g, '')
.replace(/ +/g, ' ').split(' ');
return parts.join('-');
}
function each(items, src, dest) {
return items.map(item => {
const _item = item;
_item[dest] = one(_item[src]);
return _item;
});
}
export default {
one,
each,
};