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 country-iso-3-to-2 with all npm packages installed. Try it out:

var countryIso3To2 = require("country-iso-3-to-2")

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

country-iso-3-to-2 v1.0.1

Convert a country code ISO 3166-1 Alpha-3 to ISO 3166-1 Alpha-2

country-iso-3-to-2

Convert a country code ISO 3166-1 Alpha-3 to ISO 3166-1 Alpha-2

Install

$ npm install country-iso-3-to-2

Usage

const getCountryISO2 = require("country-iso-3-to-2");

getCountryISO2("BRA")
// "BR"

getCountryISO2("USA")
// "US"

API

getCountryISO2(countryCode)

Parameter: A string with a country code in ISO 3166-1 Alpha-3

Return: A string with the country code in ISO 3166-1 Alpha-2


License

MIT © VTEX

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