Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

iso-3166-standard

jkaufman35MIT1.0.7

Converts between the International Standard Organization's 3166 standard and state names, as well as the 3166-2 standard.

iso, 3166, 3166-2, iso-3166, iso-3166-2, country, countries, code, codes

readme

ISO-3166 Standard

Provides a directory to the International Organization for Standardization's 3166 standard, including the 3166-2 standard.

ISO-3166 Standard Code Formats

The alpha-2 country code consists of two alphabetic characters.
The alpha-3 country code consists of three alphabetic characters.
The numeric code consists of a positive integer.

United States
alpha-2: US
alpha-3: USA
numeric: 840

California
division code: CA
full code: US-CA

For more information, visit the International Organization for Standardization's website here.

Functions

ISO3166.getCountry(countryCode)

Accepts an alpha-2, alpha-3, or numeric countryCode. Returns an Object of the country data if found, returns null otherwise.


ISO3166.getSubdivisions(countryCode)

Accepts an alpha-2, alpha-3, or numeric countryCode. Returns an Array of the country's subdivisions data if found, returns null otherwise.


ISO3166.getAllCountry()

Returns an Array of all countries and their respective data.