tripokey/elm-fuzzy/4.0.1

NOTE: this package is not compatible with Elm 0.19.1

Fuzzy

This is library for performing fuzzy string matching.

Matching

match : List String -> String -> String -> Int

Perform fuzzy matching between a query String (needle) and a target String (hay). The order of the arguments are significant. Lower score is better. Specifying some separators will allow for partial matching within a sentence.

Fuzzy.match [] "test" "test" == 0
Fuzzy.match [] "tst" "test" == 1
Fuzzy.match [] "test" "tste" == 100
Fuzzy.match [] "test" "tst" == 1000
Fuzzy.match ["/"] "/u/b/s" "/usr/local/bin/sh" == 5
Fuzzy.match [] "/u/b/s" "/usr/local/bin/sh" == 211
List.sortBy (Fuzzy.match [] "hrdevi") ["screen", "disk", "harddrive", "keyboard", "mouse", "computer"] == ["harddrive","keyboard","disk","screen","computer","mouse"]