avarda-ab/avarda-ui/4.0.0

NOTE: the latest version is 5.0.3

AvardaUi.Util.CountryCode

Utility module for handling ISO-style country codes used in the AvardaUi.PhoneSelectInput.

This module defines a CountryCode type representing supported countries and provides helpers to convert between the CountryCode type and its two-letter string code.

Types

= SE
| FI
| NO
| DK
| PL
| EE
| LV
| SK
| CZ
| AT
| DE
| XI
| GL
| FO
| Unknown

Supported country codes.

Parsers

Parses a two-letter country code string into a CountryCode value. Returns Unknown if the string does not match any supported code.

toString : CountryCode -> String

Converts a CountryCode value into its corresponding two-letter string code. Returns an empty string for Unknown.

toMaybeString : CountryCode -> Maybe String

Converts a CountryCode value into its corresponding two-letter string code wrapped in Maybe. Returns Nothing for Unknown.