A library for getting data about countries.
const countrydata = require( 'countrydata' );
// look up country data by ISO3166 alpha3 code (default and fastest lookup)
const usa = countrydata.get( 'USA' );
// look up country by ISO3166 alpha2
const usa_by_alpha2 = countrydata.get( 'US' );
// look up country by ISO3166 numeric
const usa_by_numeric = countrydata.get( 840 );
// .all() will return an array of all countries
const countries_using_usd = countrydata.all().filter( country => {
return country.currencies.some( ( currency ) => ( currency.code === 'USD' ) );
} );
const usa_by_find = countrydata.all().find( country => {
return country.name.en && country.name.en === 'United States';
} );
npm install --save countrydata
npm run test
Contributions are encouraged and appreciated. To make the process as quick and painless as possible for everyone involved, here's a checklist that will make a pull request easily accepted:
- Implement your new feature or bugfix
- Add or update tests to ensure coverage
- Ensure your code passes eslint using the included .eslintrc
- Ensure your code is formatted according to the .eslintrc
- Submit
MIT