NoRedInk/elm-simple-fuzzy/1.0.1

NOTE: this package is not compatible with Elm 0.19.1

Simple.Fuzzy

Fuzzy match through a list of strings

Matching and Filtering

match : String -> String -> Bool

match allows you to see if the letters of your query match within a bigger string.

match "poo" "Poo" --> True
match "poo" "Police" --> False
match "poo" "Please be polite Online!" --> True
filter : (a -> String) -> String -> List a -> List a

filter will filter an arbitrary list of objects given a function that converts the object to value you want to match on

let
    languages =
        [ { name = "Elm" }
        , { name = "Ruby" }
        , { name = "Rust" }
        , { name = "Haskell" }
        , { name = "javascript" }
        , { name = "English" }
        ]
in
    filter .name "el" languages


-- Gives:
-- [ { name = "Elm" }
-- , { name = "Haskell"}
-- , { name = "English"}
-- ]

Helpers

root : String -> String

root strips a word down to just the lower case version of itself without any punctuation or spacing.

root "Wow, I'm excited!!!!" --> "wowimexcited"