Installations
npm install rest-countries-node
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
13.14.0
NPM Version
6.14.4
Score
72.1
Supply Chain
93.4
Quality
71.9
Maintenance
50
Vulnerability
97.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
fegoa89
Download Statistics
Total Downloads
5,514
Last Day
1
Last Week
15
Last Month
63
Last Year
215
GitHub Statistics
3 Stars
53 Commits
1 Forks
2 Watching
3 Branches
1 Contributors
Bundle Size
799.06 kB
Minified
217.44 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.3.0
Package Id
rest-countries-node@1.3.0
Unpacked Size
77.40 kB
Size
13.15 kB
File Count
16
NPM Version
6.14.4
Node Version
13.14.0
Total Downloads
Cumulative downloads
Total Downloads
5,514
Last day
0%
1
Compared to previous day
Last week
87.5%
15
Compared to previous week
Last month
600%
63
Compared to previous month
Last year
-26.4%
215
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Rest Country Node
A Node.js wrapper library around the API provided by https://restcountries.com. Using API version 3.1.
Available methods
findCountryFlagByCountryName()
Usage
1var RestCountries = require('rest-countries-node'); 2restCountries = new RestCountries;
getAll
Returns all countries information:
1restCountries.getAll() 2 .then(response => { 3 /*...*/ 4 });
findByName
Search by country name. It can be the native name or partial name:
1restCountries.findByName('france') 2 .then(response => { 3 /* 4 [ 5 { 6 "alpha2Code": "FR", 7 "alpha3Code": "FRA", 8 "altSpellings": [ 9 "FR", 10 "French Republic", 11 "République française" 12 ], 13 ... 14 } 15 ] 16 */ 17 });
findByFullName
Search by country full name:
1restCountries.findByFullName('france') 2 .then(response => { 3 /* 4 [ 5 { 6 "alpha2Code": "FR", 7 "alpha3Code": "FRA", 8 "altSpellings": [ 9 "FR", 10 "French Republic", 11 "République française" 12 ], 13 ... 14 } 15 ] 16 */ 17 });
findByIsoCountryCode
Search by ISO 3166-1 2-letter or 3-letter country code:
1restCountries.findByIsoCountryCode('bg') 2 .then(response => { 3 /* 4 { 5 "alpha2Code": "BG", 6 "alpha3Code": "BGR", 7 "altSpellings": [ 8 "BG", 9 "Republic of Bulgaria", 10 "Република България" 11 ], 12 ... 13 } 14 */ 15 });
findByIsoCountryCodes
Search by list of ISO 3166-1 2-letter or 3-letter country codes:
1restCountries.findByIsoCountryCodes('pl;gb;it') 2 .then(response => { 3 /* 4 [ 5 { 6 "alpha2Code": "PL", 7 "alpha3Code": "POL", 8 "altSpellings": [ 9 "PL", 10 "Republic of Poland", 11 "Rzeczpospolita Polska" 12 ], 13 ... 14 }, 15 { 16 "alpha2Code": "GB", 17 "alpha3Code": "GBR", 18 "altSpellings": [ 19 "GB", 20 "UK", 21 "Great Britain" 22 ], 23 ... 24 }, 25 { 26 "alpha2Code": "IT", 27 "alpha3Code": "ITA", 28 "altSpellings": [ 29 "IT", 30 "Italian Republic", 31 "Repubblica italiana" 32 ], 33 ... 34 } 35 ] 36 */ 37 });
findByCurrency
Search by ISO 4217 currency code:
1restCountries.findByCurrency('pln') 2 .then(response => { 3 /* 4 [ 5 { 6 "alpha2Code": "PL", 7 "alpha3Code": "POL", 8 "altSpellings": [ 9 "PL", 10 "Republic of Poland", 11 "Rzeczpospolita Polska" 12 ], 13 ... 14 } 15 ] 16 */ 17 });
findByLanguageCode
Search by ISO 639-1 language code:
1restCountries.findByLanguageCode('italian') 2 .then(response => { 3 /* 4 [ 5 { 6 "alpha2Code": "VA", 7 "alpha3Code": "VAT", 8 "altSpellings": [ 9 "Sancta Sedes", 10 "Vatican", 11 "The Vatican" 12 ], 13 ... 14 }, 15 { 16 "alpha2Code": "IT", 17 "alpha3Code": "ITA", 18 "altSpellings": [ 19 "IT", 20 "Italian Republic", 21 "Repubblica italiana" 22 ], 23 ... 24 } 25 ] 26 */ 27 });
findByCapitalCity
Search by capital city:
1restCountries.findByCapitalCity('tallinn') 2 .then(response => { 3 /* 4 [ 5 { 6 "alpha2Code": "EE", 7 "alpha3Code": "EST", 8 "altSpellings": [ 9 "EE", 10 "Eesti", 11 "Republic of Estonia", 12 "Eesti Vabariik" 13 ], 14 ... 15 } 16 ] 17 */ 18 });
findByCallingCode
Search by calling code:
1restCountries.findByCallingCode('377') 2 .then(response => { 3 /* 4 [ 5 { 6 "alpha2Code": "MC", 7 "alpha3Code": "MCO", 8 "altSpellings": [ 9 "MC", 10 "Principality of Monaco", 11 "Principauté de Monaco" 12 ], 13 ... 14 } 15 ] 16 */ 17 });
findByRegion
Search by region (Africa, Americas, Asia, Europe, Oceania) :
1restCountries.findByRegion('oceania') 2 .then(response => { 3 /* 4 [ 5 { 6 "alpha2Code": "AS", 7 "alpha3Code": "ASM", 8 "altSpellings": [ 9 "AS", 10 "Amerika Sāmoa", 11 "Amelika Sāmoa", 12 "Sāmoa Amelika" 13 ], 14 ... 15 }, 16 ... 17 ] 18 */ 19 });
getAllGroupedBySubRegion
Returns a list of countries grouped by subregions:
1restCountries.getAllGroupedBySubRegion() 2 .then(response => { 3 /* 4 { "southern-europe": 5 [ 6 { 7 "alpha2Code": "ES", 8 "alpha3Code": "ESP", 9 "altSpellings": [ 10 "ES", 11 "Kingdom of Spain", 12 "Reino de España" 13 ], 14 ... 15 }, 16 ... 17 ], 18 "south-america": 19 [ 20 { 21 "alpha2Code": "CO", 22 "alpha3Code": "COL", 23 "altSpellings": [ 24 "CO", 25 "Republic of Colombia", 26 "República de Colombia" 27 ], 28 ... 29 }, 30 ... 31 ], 32 ... 33 } 34 */ 35 });
getAllGroupedByRegion
Returns a list of countries grouped by regions:
1restCountries.getAllGroupedByRegion() 2 .then(response => { 3 /* 4 { 5 "europe": [ 6 { 7 "alpha2Code": "ES", 8 "alpha3Code": "ESP", 9 "altSpellings": [ 10 "ES", 11 "Kingdom of Spain", 12 "Reino de España" 13 ], 14 ... 15 }, 16 { 17 "alpha2Code": "DE", 18 "alpha3Code": "DEU", 19 "altSpellings": [ 20 "DE", 21 "Federal Republic of Germany", 22 "Bundesrepublik Deutschland" 23 ], 24 } 25 ], 26 "americas": [ 27 { 28 "alpha2Code": "CO", 29 "alpha3Code": "COL", 30 "altSpellings": [ 31 "CO", 32 "Republic of Colombia", 33 "República de Colombia" 34 ], 35 ... 36 } 37 ] 38 } 39 40 */ 41 });
findCountryFlagByCountryName
Returns the flag for a given country :
1restCountries.findCountryFlagByCountryName('Spain') 2 .then(response => { 3 /* 4 { 5 "countryName": "Spain", 6 "flag": "https://restcountries.com/data/esp.svg" 7 } 8 */ 9 });
findCountryByForeignName
Returns the flag for a given country :
1restCountries.findCountryByForeignName('スペイン') 2 .then(response => { 3 /* 4 { 5 "alpha2Code": "ES", 6 "alpha3Code": "ESP", 7 "altSpellings": [ 8 "ES", 9 "Kingdom of Spain", 10 "Reino de España" 11 ], 12 ... 13 } 14 */ 15 });
getNearestCountryToPosition
Returns the nearest country to the input lat/lon:
1restCountries.getNearestCountryToPosition({lat: 50.0, lon: 9.0}) 2 .then(response => { 3 /* 4 { 5 "alpha2Code": "DE", 6 "alpha3Code": "DEU", 7 "altSpellings": [ 8 "DE", 9 "Federal Republic of Germany", 10 "Bundesrepublik Deutschland" 11 ], 12 ... 13 } 14 */ 15 });
getAllGroupedByTimezone
Returns a list of countries grouped by timezone:
1restCountries.getAllGroupedByTimezone() 2 .then(response => { 3 /* 4 { 5 "UTC": [ 6 { 7 "alpha2Code": "ES", 8 "alpha3Code": "ESP", 9 "altSpellings": [ 10 "ES", 11 "Kingdom of Spain", 12 "Reino de España" 13 ], 14 ... 15 } 16 ], 17 "UTC+01:00": [ 18 { 19 "alpha2Code": "ES", 20 "alpha3Code": "ESP", 21 "altSpellings": [ 22 "ES", 23 "Kingdom of Spain", 24 "Reino de España" 25 ], 26 ... 27 }, 28 { 29 "alpha2Code": "DE", 30 "alpha3Code": "DEU", 31 "altSpellings": [ 32 "DE", 33 "Federal Republic of Germany", 34 "Bundesrepublik Deutschland" 35 ], 36 ... 37 } 38 ], 39 "UTC-05:00": [ 40 { 41 "alpha2Code": "CO", 42 "alpha3Code": "COL", 43 "altSpellings": [ 44 "CO", 45 "Republic of Colombia", 46 "República de Colombia" 47 ], 48 ... 49 } 50 ] 51 } 52 */ 53 });
getCountriesByTimezone
Returns a list of countries that belong to a timezone:
1restCountries.getCountriesByTimezone('UTC-05:00') 2 .then(response => { 3 /* 4 { 5 "UTC-05:00": [ 6 { 7 "alpha2Code": "CO", 8 "alpha3Code": "COL", 9 "altSpellings": [ 10 "CO", 11 "Republic of Colombia", 12 "República de Colombia" 13 ], 14 ... 15 } 16 ] 17 } 18 */ 19 });
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/20 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 10 are checked with a SAST tool
Reason
13 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
Score
1.7
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More