Skip to content

Instantly share code, notes, and snippets.

View brenapp's full-sized avatar
🐵
Code Wranglin

Brendan McGuire brenapp

🐵
Code Wranglin
View GitHub Profile
@brenapp
brenapp / fuzzysearch.js
Created September 26, 2015 02:14
A very basic Fuzzy Search in 66 bytes
/* Fuzzy Search in JavaScript in 66 bytes by SpeedyNinja
Creates a Regex of the Form x.*y.*z.* for query xyz and tests it against the list of terms
*/
f=t=>s=>t.filter(x=>eval("/"+s.replace(/./,"$&.*")+"/gi").test(x))
/*
Usage:
var search = f(["list", "of", "search", "terms"])
search("er") -> ["search", "terms"]
^ ^ ^^
We couldn’t find that file to show.