Skip to content

Instantly share code, notes, and snippets.

@r7kamura
Created April 30, 2015 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r7kamura/ebfb0968e74afde9d812 to your computer and use it in GitHub Desktop.
Save r7kamura/ebfb0968e74afde9d812 to your computer and use it in GitHub Desktop.
ファ
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