Countriex v0.3.0
Countriex
Provides all sorts useful information for every country in the ISO 3166 standard, and helper methods to filter/retrieve that information by.
Summary
Returns all countries matching the given criteria, or []
if the criteria does not match any countries
Returns the first matching country with the given criteria, or nil
if a country with that data does not exist
Functions
Returns all countries matching the given criteria, or []
if the criteria does not match any countries
Examples
iex> c = Countriex.filter(:region, "Americas")
iex> c |> List.first |> Map.get(:name)
"Antigua and Barbuda"
iex> c |> length
57
iex> Countriex.filter(:region, "foo")
[]
Returns the first matching country with the given criteria, or nil
if a country with that data does not exist.
Examples
iex> c = Countriex.get_by(:alpha2, "US")
iex> c.name
"United States of America"
iex> Countriex.get_by(:alpha2, "XX")
nil
iex> Countriex.get_by(:foo, "XX")
nil