mcordova47/elm-natural-ordering/1.0.1

NOTE: this package is not compatible with Elm 0.19.1

NaturalOrdering

Compare strings with numbers and diacritics "naturally"

compare : String -> String -> Order

Compare two strings naturally.

List.sortWith NaturalOrdering.compare ["a10", "a2"]
--> ["a2", "a10"]
compareOn : (a -> String) -> a -> a -> Order

Compare two as naturally, based on some function, a -> String. Use this where you would ordinarily use sortBy.

List.sortWith (compareOn .name) [{ name = "a10" }, { name = "a2" }]
--> [{ name = "a2" }, { name = "a10" }]