allow regexes for fuzzyfind.
This commit is contained in:
parent
2666a008bf
commit
2c00450029
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue