Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including iso-3166-standard with all npm packages installed. Try it out:

var iso3166Standard = require("iso-3166-standard")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

iso-3166-standard v1.0.7

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

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.

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free