countrydata

3.0.1 • Public • Published

countrydata

A library for getting data about countries.

Code Example

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';
} );

Installation

npm install --save countrydata

Tests

npm run test

Contributing

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:

  1. Implement your new feature or bugfix
  2. Add or update tests to ensure coverage
  3. Ensure your code passes eslint using the included .eslintrc
  4. Ensure your code is formatted according to the .eslintrc
  5. Submit

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i countrydata

Weekly Downloads

209

Version

3.0.1

License

MIT

Unpacked Size

187 kB

Total Files

5

Last publish

Collaborators

  • andyburke