Skip to content

Instantly share code, notes, and snippets.

@xbill82
Created November 27, 2013 17:48
Show Gist options
  • Save xbill82/7680025 to your computer and use it in GitHub Desktop.
Save xbill82/7680025 to your computer and use it in GitHub Desktop.
JavaScript: Fuzzy search over string
String.prototype.fuzzy = function (s) {
var hay = this.toLowerCase(), i = 0, n = 0, l;
s = s.toLowerCase();
for (; l = s[i++] ;) if ((n = hay.indexOf(l, n)) === -1) return false;
return true;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment