Gathering detailed insights and metrics for rest-countries-node
Gathering detailed insights and metrics for rest-countries-node
npm install rest-countries-node
Typescript
Module System
Node Version
NPM Version
72.1
Supply Chain
93.4
Quality
71.9
Maintenance
50
Vulnerability
97.6
License
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
5,514
Last Day
1
Last Week
15
Last Month
63
Last Year
215
3 Stars
53 Commits
1 Forks
2 Watching
3 Branches
1 Contributors
Minified
Minified + Gzipped
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
Cumulative downloads
Total Downloads
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
A Node.js wrapper library around the API provided by https://restcountries.com. Using API version 3.1.
findCountryFlagByCountryName()
1var RestCountries = require('rest-countries-node'); 2restCountries = new RestCountries;
Returns all countries information:
1restCountries.getAll() 2 .then(response => { 3 /*...*/ 4 });
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 });
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 });
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 });
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 });
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 });
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 });
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 });
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 });
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 });
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 });
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 });
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 });
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 });
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 });
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 });
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
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
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
13 existing vulnerabilities detected
Details
Score
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