Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
country-list-js
Advanced tools
<script src="/path/to/country.min.js"></script>
or
npm install --save country-list-js
var country = new Country;
var found = country.find('BD', country.FIND_BY_ISO_ALPHA_2);
var found = country.find('BGD', country.FIND_BY_ISO_ALPHA_3);
var found = country.find('Bangladesh', country.FIND_BY_NAME);
var found = country.find('Capital', country.FIND_BY_CAPITAL);
var found = country.find('BDT', country.FIND_BY_CURRENCY);
var found = country.find('880', country.FIND_BY_PHONE_NBR);
The search option can also be hard coded as following
country.FIND_BY_ALPHA_2 = 1
country.FIND_BY_ALPHA_3 = 2
country.FIND_BY_NAME = 3
country.FIND_BY_CAPITAL = 4
country.FIND_BY_CURRENCY = 5
country.FIND_BY_PHONE_NBR = 6
country.find('BD', country.FIND_BY_ISO_ALPHA_2);
can be written as country.find('BD', 1);
If the country was not found, the variable found
will be null
.
The return value of all of those above will be similar to the following
{
continent: "Asia",
name: "Bangladesh",
code: {
iso_alpha_2: "BD",
iso_alpha_3: "BGD"
},
capital: "Dhaka",
currency: {
code: "BDT",
symbol: "Tk",
decimal: "2"
},
dialing_code: "880"
}
Once the search has been made, if the country was found, the information is stored in the instance. We can retrieve the information without having to search again.
var found = country.info();
var name = country.info('name'); //Bangladesh
var iso_alpha_2 = country.info('iso_alpha_2'); //BD
var iso_alpha_3 = country.info('iso_alpha_3'); //BGD
var continent = country.info('continent'); //Asia
var capital = country.info('capital'); //Dhaka
var currency = country.info('currency'); //{ code: "BDT", symbol: "Tk", decimal: "2"}
currency.code //BDT
currency.symbol //Tk
currency.decimal //2
var dialing_code = country.info('dialing_code'); //880
Object destructor supported since 2.0.0
import {findByName} from 'country-list-js';
const country = findByName('Bangladesh');
Available functions
npm run test
npm run build
FAQs
Country list with ISO2, ISO3 code, continent, capital, dialing code
The npm package country-list-js receives a total of 7,755 weekly downloads. As such, country-list-js popularity was classified as popular.
We found that country-list-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.