2.1.1 • Published 5 years ago

@legendaryrob/countrify v2.1.1

Weekly downloads
25
License
MIT
Repository
github
Last release
5 years ago

@legendaryrob/countrify

npm (scoped) npm bundle size (minified)

Install

$ npm install @legendaryrob/countrify

Usage

const countrify = require("@legendaryrob/countrify")

// Finding names

countrify.getName("USD");
//=> "United States of America"

countrify.getName("US");
//=> "United States of America"


// Getting Alpha3 codes

countrify.getAlpha3("South Africa");
//=> "SAF"

countrify.getAlpha3("SA");
//=> "SAF"

// Getting Alpha2 codes

countrify.getAlpha3("South Africa");
//=> "SA"

countrify.getAlpha3("SAF");
//=> "SA"

// Getting a list of all the countries

countrify.allCountriesList();
//=> ['Andorra', 'United Arab Emirates', 'Afghanistan'...]

// Getting a list of all the subdivisions for country

countrify.getSubdivisionsList('South Africa', 'en');
//=> ['Eastern Cape', 'Free State', 'Gauteng'...]

// are able to swap out the country name with alpha2/alpha3
countrify.getSubdivisionsList('SAF', 'en');
//=> ['Eastern Cape', 'Free State', 'Gauteng'...]

// are able to swap out the country name with alpha2/alpha3
countrify.getSubdivisionsList('SAF', 'fr');
//=> ['Cap oriental', 'État-Libre', 'Gauteng'...]
2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago