Gathering detailed insights and metrics for country-data-list
Gathering detailed insights and metrics for country-data-list
Gathering detailed insights and metrics for country-data-list
Gathering detailed insights and metrics for country-data-list
countries-list
Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.
country-region-data
List of countries, regions, and their shortcodes.
all-country-data
This package provides extra functionality like list of countries and their capitals. Primary language, ISD Codes, Country Codes, Currency Name, Country Flags, Currency Codes will also be provided.
@qfast/country-region-data
List of countries, regions, and their codes.
Country related data such as ISO codes, currencies etc
npm install country-data-list
Typescript
Module System
Node Version
NPM Version
92.9
Supply Chain
100
Quality
87.1
Maintenance
100
Vulnerability
100
License
JavaScript (99.34%)
HTML (0.66%)
Total Downloads
760,387
Last Day
2,553
Last Week
8,737
Last Month
37,670
Last Year
378,737
26 Stars
285 Commits
12 Forks
2 Watching
3 Branches
25 Contributors
Minified
Minified + Gzipped
Latest Version
1.4.0
Package Id
country-data-list@1.4.0
Unpacked Size
338.45 kB
Size
58.99 kB
File Count
54
NPM Version
10.8.2
Node Version
20.13.1
Publised On
19 Jan 2025
Cumulative downloads
Total Downloads
Last day
-7.7%
2,553
Compared to previous day
Last week
-22.8%
8,737
Compared to previous week
Last month
0.7%
37,670
Compared to previous month
Last year
108%
378,737
Compared to previous year
There are lots of little bits of data that you often need relating to countries, and I couldn't find any easy to use source of it. So I compiled it all here.
feel free to use it, but be sure to check between upgrades.
I suspect that many of the currencies
entries on the countries may be wrong. Help checking them would be appreciated.
The data currently provided for each country is:
name
The english name for the countryalpha2
The ISO 3166-1 alpha 2 codealpha3
The ISO 3166-1 alpha 3 codestatus
: The ISO status of the entry - see below.currencies
An array of ISO 4217 currency codes with the primary one firstlanguages
An array of ISO 639-2 codes for languages (may not be complete).countryCallingCodes
An array of the international call prefixes for this country.ioc
The International Olympic Committee country codeemoji
The emoji of country's flag.subunits
Geographically disjoint components like Alaska in the USA, administratively distinct regions such as the countries of Great Britain, or overseas islands for many European nations.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.
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.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 currencycode
The ISO 4217 codenumber
The ISO 4217 numberdecimals
The number of decimal digits conventionally shownsymbol
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.A list of languages provided by ISO 639-2;
name
The english name for the languagealpha2
The two letter ISO 639-1 code for the language (may be blank).alpha3
The three letter terminological ISO 639-2 code for the language (may be blank).bibliograpic
The three letter bibliographic ISO 639-2 code for the language (may be blank).To make finding easier there are utility methods that can search the countries and currencies. See examples below.
Include the dist via the script tag
1<script src='dist/country-data-list.min.js' /> 2<script> 3 window.CountryDataList.getSymbolFromCurrency('USD') //=> '$' 4</script>
1npm install country-data-list
1var countries = require('country-data-list').countries, 2 currencies = require('country-data-list').currencies, 3 regions = require('country-data-list').regions, 4 languages = require('country-data-list').languages, 5 callingCountries = require('country-data-list').callingCountries; 6 7// .all gives you an array of all entries 8console.log( countries.all ); 9console.log( currencies.all ); 10 11// countries are found using alpha2 or alpha3 (both uppercase) 12console.log( countries.BE.name ); // 'Belgium' 13console.log( countries.FRA.currencies ); // ['EUR'] 14 15// callingCountries is like countries but only has entries with dialing codes. 16 17// currencies are accessed by their code (uppercase) 18console.log( currencies.USD.name ); // 'United States dollar' 19 20// regions are accessed using a camel case name 21console.log( regions.europe.countries )
1var lookup = require('country-data-list').lookup; 2 3// Match a value (grab first from array) case insensitive 4var france = lookup.countries({name: 'France'})[0]; 5 6// Or match one of several possible values. 7var eurozone_countries = lookup.countries({currencies: 'EUR'});
import {countries} from 'country-data-list';
console.log(countries.all);
// You can also use
import {lookup} from 'country-data-list';
// Match a value (grab first from array) case insensitive
const france = lookup.countries({name: 'France'})[0];
It is very simple for now - feel free to contribute more helpful accessors.
More data for each country is most welcome. Obvious things that it might be nice to add are:
You can change on JSON.
These are the steps required:
1# Clone the repo (or better your fork of it) 2git clone https://github.com/Sonatrix/country-list.git 3cd country-list 4 5# install the dependencies 6npm install . 7 8# Edit the countries.js 9open data/countries.js 10 11 12# Run the tests 13mocha 14 15# If all is ok commit and push 16git add . 17git commit 18git push 19 20# Then send a pull request with your changes. Ideally use several small commits, 21# and reference a source that backs up the change.
The currency data was copied from the Wikipedia ISO 4217 page.
The country calling codes came from the Wikipedia country calling codes page.
No vulnerabilities found.
No security vulnerabilities found.