avarda-ab/avarda-ui/5.0.1

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

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

Supported country codes.

Two-letter ISO Parsers

Parses a two-letter ISO 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 ISO string code. Returns an empty string for Unknown.

toMaybeString : CountryCode -> Maybe String

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

Three-letter ISO Parsers

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

Converts a CountryCode value into its corresponding three-letter ISO string code. Returns an empty string for Unknown and XI.

Converts a CountryCode value into its corresponding three-letter ISO string code wrapped in Maybe. Returns Nothing for Unknown and XI.