Chadtech/elm-us-state-abbreviations/1.0.2

NOTE: this package is not compatible with Elm 0.19.1

UsStates

Here are the abbreviations for every US State, as a union type, and two functions to convert to state names as strings.

= AL
| AK
| AZ
| AR
| CA
| CO
| CT
| DE
| DC
| FL
| GA
| HI
| ID
| IL
| IN
| IA
| KS
| KY
| LA
| ME
| MT
| NE
| NV
| NH
| NJ
| NM
| NY
| NC
| ND
| OH
| OK
| OR
| MD
| MA
| MI
| MN
| MS
| MO
| PA
| RI
| SC
| SD
| TN
| TX
| UT
| VT
| VA
| WA
| WV
| WI
| WY

Every US State abbreviation.

import UsState exposing (Abbreviation(..))


toString AZ == "AZ"  -- True
toState : Abbreviation -> String

Get the states name from the abbreviation

UsState.toState AZ == "arizona" -- True
fromState : String -> Maybe Abbreviation

Get the states abbreviation from its name

UsState.fromState "Arizona" == Just AZ     -- True
UsState.fromState "Arizona   " == Just AZ  -- True
UsState.fromState "arizona" == Just AZ     -- True


UsState.fromState "puerto rico" == Nothing -- True