allow regexes for fuzzyfind.

This commit is contained in:
Christopher Jeffrey 2015-04-18 22:21:11 -07:00
parent 2666a008bf
commit 2c00450029
1 changed files with 9 additions and 0 deletions

View File

@ -5248,6 +5248,15 @@ List.prototype.appendItem = function(item) {
List.prototype.fuzzyFind = function(search, back) {
var index = this.getItemIndex(this.selected);
var start = this.selected + (back ? -1 : 1);
if (search[0] === '/' && search[search.length - 1] === '/') {
try {
search = new RegExp(search.slice(1, -1));
} catch (e) {
;
}
}
var finder = typeof search === 'string'
? function(item) { return !!~item.indexOf(search); }
: search.test.bind(search);