blob: ab26035b804a87e125eadda1f3f965f1a6ffa391 [file] [log] [blame]
module.exports = new FuzzySearchStrategy();
function FuzzySearchStrategy(){
var self = this;
function createFuzzyRegExpFromString(string){
return new RegExp( string.split('').join('.*?'), 'gi');
}
self.matches = function(string,crit){
if( typeof string !== 'string' ) return false;
string = string.trim();
return !!string.match(createFuzzyRegExpFromString(crit));
};
};