Giter Club home page Giter Club logo

country-data's Introduction

Country Data

npm Main CI codecov code style: prettier semantic-release GitHub

Data about countries - like their ISO codes and currencies - with typings.

Installation

npm install @aerapass/country-data

Usage

import { countries, continents, currencies, regions } from '@aerapass/country-data'

// .all gives you an array of all entries
console.log(countries.all)
console.log(currencies.all)

// countries are found using alpha2 or alpha3 (both uppercase)
console.log(countries.BE.name) // 'Belgium'
console.log(countries.FRA.currencies) // ['EUR']

// currencies are accessed by their code (uppercase)
console.log(currencies.USD.name) // 'United States dollar'

// regions are accessed using a camel case name
console.log(regions.europe.countries)

Countries

The data currently provided for each country is:

Status notes

The status can be one of 'assigned', 'reserved', 'user assigned' or 'deleted'.

Assigned means that the code is properly in the ISO 3166 standard. Reserved means that the code is being prevented from being used. Deleted means that it has been deleted. User Assigned means that for some use cases it is required. Deleted means that it used to be in the standard but is now not.

See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for full details, especially the "User-assigned code elements" and "Reserved code elements" sections.

Regions

Countries are ofter grouped into regions. The list of regions is by no means exhaustive, pull requests very welcome for additions.

  • countries An array of alpha2 codes for the countries in this region.

Currencies

It is not that useful to just have the currency code(s) for a country, so included is currency data too:

  • name The english name for the currency
  • code The ISO 4217 code
  • number The ISO 4217 number
  • decimals The number of decimal digits conventionally shown
  • symbol The currency symbol for the currency (e.g. ¥, $ etc.). Some symbols are not available, in which case symbol contains the ISO 4217 code. Credit to bengourley/currency-symbol-map for the symbol database.

Sources

The currency data was copied from the Wikipedia ISO 4217 page.

The country calling codes came from the Wikipedia country calling codes page.

country-data's People

Contributors

renovate[bot] avatar ppetzold avatar kevincris avatar dependabot[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.