LivePhone.get_country
You're seeing just the function
get_country
, go back to LivePhone module for more information.
Specs
get_country(String.t()) :: {:ok, LivePhone.Countries.Country.t()} | {:error, :invalid_number}
This is used to try and get a Country
for a given phone number.
Examples
iex> LivePhone.get_country("")
{:error, :invalid_number}
iex> LivePhone.get_country("+1555")
{:error, :invalid_number}
iex> LivePhone.get_country("+1555")
{:error, :invalid_number}
iex> LivePhone.get_country("+1 (555) 555-1234")
{:error, :invalid_number}
iex> LivePhone.get_country("+1 (555) 555-1234")
{:error, :invalid_number}
iex> LivePhone.get_country("+1 (650) 253-0000")
{:ok, %LivePhone.Country{code: "US", flag_emoji: "πΊπΈ", name: "United States of America (the)", preferred: false, region_code: "1"}}
iex> LivePhone.get_country("+16502530000")
{:ok, %LivePhone.Country{code: "US", flag_emoji: "πΊπΈ", name: "United States of America (the)", preferred: false, region_code: "1"}}