Created
April 30, 2015 05:47
-
-
Save r7kamura/ebfb0968e74afde9d812 to your computer and use it in GitHub Desktop.
ファ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fuzzysearch: (haystack, needle) -> | |
lowHaystack = haystack.toLowerCase() | |
lowNeedle = needle.toLowerCase() | |
i = 0 | |
n = 0 | |
l = undefined | |
while l = lowNeedle[i++] | |
if ((n = lowHaystack.indexOf(l, n)) == -1) | |
return false | |
else | |
n++ | |
true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment