Installations
npm install what-country
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
14.17.3
NPM Version
6.14.13
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
webdacjs
Download Statistics
Total Downloads
30,599
Last Day
5
Last Week
39
Last Month
108
Last Year
7,082
GitHub Statistics
1 Stars
69 Commits
3 Forks
2 Watching
7 Branches
1 Contributors
Bundle Size
836.14 kB
Minified
224.18 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.8.0
Package Id
what-country@1.8.0
Unpacked Size
913.23 kB
Size
223.96 kB
File Count
9
NPM Version
6.14.13
Node Version
14.17.3
Total Downloads
Cumulative downloads
Total Downloads
30,599
Last day
66.7%
5
Compared to previous day
Last week
34.5%
39
Compared to previous week
Last month
-3.6%
108
Compared to previous month
Last year
5.2%
7,082
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
3
Dev Dependencies
1
What Country
This module get country information based on the query provided based on different available parameters such as the country name, iso code, tld, currency, phone, etc. The module supports querying the data in multiple languages.
The most basic use is:
1> const {query} = require('what-country') 2> query('ireland') 3[ { iso: 'IE', 4 iso3: 'IRL', 5 iso_numeric: '372', 6 name: 'Ireland', 7 capital: 'Dublin', 8 continent: 'EU', 9 tld: '.ie', 10 currencycode: 'EUR', 11 currencyname: 'Euro', 12 phone: '353' } ] 13// or 14> query('.ie') 15[ { iso: 'IE', 16 iso3: 'IRL', 17 iso_numeric: '372', 18 name: 'Ireland', 19 capital: 'Dublin', 20 continent: 'EU', 21 tld: '.ie', 22 currencycode: 'EUR', 23 currencyname: 'Euro', 24 phone: '353' } ]
Install
You can install with [npm]:
1$ npm install --save what-country
Usage
The module provides a query
function to get the country information by name, iso code, iso3 code or tld. You can also specific get data by currency using queryCurrency
or by phone using queryPhone
.
You can specify the field / fields to get in the reply with an optional second argument:
1> queryCurrency('EUR', 'name') 2[ { name: 'Andorra' }, 3 { name: 'Austria' }, 4 { name: 'Aland Islands' }, 5 { name: 'Belgium' }, 6 { name: 'Saint Barthelemy' }, 7 { name: 'Cyprus' }, 8 { name: 'Germany' }, 9 { name: 'Estonia' }, 10 { name: 'Spain' }, 11 { name: 'Finland' }, 12 { name: 'France' }, 13 { name: 'French Guiana' }, 14 { name: 'Guadeloupe' }, 15 { name: 'Greece' }, 16 { name: 'Ireland' }, 17 { name: 'Italy' }, 18 { name: 'Kosovo' }, 19 { name: 'Lithuania' }, 20 { name: 'Luxembourg' }, 21 { name: 'Latvia' }, 22 { name: 'Monaco' }, 23 { name: 'Montenegro' }, 24 { name: 'Saint Martin' }, 25 { name: 'Martinique' }, 26 { name: 'Malta' }, 27 { name: 'Netherlands' }, 28 { name: 'Saint Pierre and Miquelon' }, 29 { name: 'Portugal' }, 30 { name: 'Reunion' }, 31 { name: 'Slovenia' }, 32 { name: 'Slovakia' }, 33 { name: 'San Marino' }, 34 { name: 'French Southern Territories' }, 35 { name: 'Vatican' }, 36 { name: 'Mayotte' } ]
You can even get results querying the country using another language:
1> const {query} = require('what-country') 2// In German 3> query('irland') 4[ { iso: 'IE', 5 iso3: 'IRL', 6 iso_numeric: '372', 7 name: 'Ireland', 8 capital: 'Dublin', 9 continent: 'EU', 10 tld: '.ie', 11 currencycode: 'EUR', 12 currencyname: 'Euro', 13 phone: '353' } ] 14 15// or in French 16 17// In German 18> query('irlande') 19[ { iso: 'IE', 20 iso3: 'IRL', 21 iso_numeric: '372', 22 name: 'Ireland', 23 capital: 'Dublin', 24 continent: 'EU', 25 tld: '.ie', 26 currencycode: 'EUR', 27 currencyname: 'Euro', 28 phone: '353' } ] 29 30// Or even Japan in Japanese!!! 31> f.query('日本') 32[ { iso: 'JP', 33 iso3: 'JPN', 34 iso_numeric: '392', 35 name: 'Japan', 36 capital: 'Tokyo', 37 continent: 'AS', 38 tld: '.jp', 39 currencycode: 'JPY', 40 currencyname: 'Yen', 41 phone: '81' } ]
Finally the module will try to address cases where the input have duplicate entries:
1> const {query} = require('what-country') 2 3// Duplicate Ireland name. 4 5> query('Ireland Ireland') 6[ { iso: 'IE', 7 iso3: 'IRL', 8 iso_numeric: '372', 9 name: 'Ireland', 10 capital: 'Dublin', 11 continent: 'EU', 12 tld: '.ie', 13 currencycode: 'EUR', 14 currencyname: 'Euro', 15 phone: '353' } ] 16
License
Copyright © 2020, Juan Convers. Released under the MIT License.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
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
9 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/16 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 16 are checked with a SAST tool
Score
1.9
/10
Last Scanned on 2025-01-20
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 MoreOther packages similar to what-country
whatsapp-country-code
npm package to fetch the list of country name and codes supported by whatsapp.
@eightmedia/flags-country-names-and-nationalities-with-eer
All flags, countries they belong to and what the nationality is called in: - Dutch
@rasamizafy/holidate
Loading ReadMe... ## What is it ? holidates is a tool I created during my training in web development at BeCode Liège, Belgium. It will allow you to display a list of holidays of the current year for the country name you will enter.