Fuzzy searching allows for flexibly matching a string with partial input, useful for filtering data very quickly based on lightweight user input.
fuzzysearch in action, head over to bevacqua.github.io/horsey, which is a demo of an autocomplete component that uses
fuzzysearch to filter out results based on user input.
npm install --save fuzzysearch
haystack using a fuzzy-searching algorithm. Note that this program doesn't implement levenshtein distance, but rather a simplified version where there's no approximation. The method will return
true only if each character in the
needle can be found in the
haystack and occurs after the preceding character.
// <- true// <- true// <- true// <- true// <- true// <- false// <- false
An exciting application for this kind of algorithm is to filter options from an autocomplete menu, check out horsey for an example on how that might look like.