Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

@legendaryrob/countrify

2.1.1 • Public • Published

@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'...]
 

Install

npm i @legendaryrob/countrify

DownloadsWeekly Downloads

9

Version

2.1.1

License

MIT

Unpacked Size

8.92 MB

Total Files

492

Last publish

Collaborators

  • avatar