Skip to content

Commit

Permalink
Merge pull request #6249 from spalger/fix/CustomLabel
Browse files Browse the repository at this point in the history
[filters/label] use _.words and _.capitalize
  • Loading branch information
Matt Bargar committed Mar 3, 2016
2 parents 8a0b74a + 3791f1b commit 60f870b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/ui/public/filters/label.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import uiModules from 'ui/modules';
import { words, capitalize } from 'lodash';

uiModules
.get('kibana')
.filter('label', function () {
return function (str) {
var words = str.split(' ');
return words.map(capFirst).join(' ');
return words(str).map(capitalize).join(' ');
};
});

function capFirst(str) {
var i = str[0];
var r = new RegExp(i, 'i');
return str.replace(r, i.toUpperCase());
}

0 comments on commit 60f870b

Please sign in to comment.