Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
String Fuzzy Search
'use strict';
function fuzzySearch (subject, pattern) {
var i = 0, n = -1, l;
subject = subject.toLowerCase();
pattern = pattern.toLowerCase();
for (; l = pattern[i++];)
if (!~(n = subject.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
You can’t perform that action at this time.