
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
state-country
Advanced tools
Get a list of all countries, states, or states within a country.
Note: only returns names for countries and states, which makes this a simple and minimal package.
Other popular libraries include city data and extended country/state data (e.g. phone or currency info), which inflates package size by quite a lot. But if you don't need city data and you only need country/state names, this package is a fast, simple, and lightweight alternative.
Installation
npm i state-country
or
yarn add state-country
Usage
import stateCountry from 'state-country';
or
const stateCountry = require('state-country');
Get all countries in the world
const countriesList = stateCountry.getAllCountries();
Get all states in the world
const statesList = stateCountry.getAllStates();
Get all states in a given country
const statesInCountryList = stateCountry.getAllStatesInCountry('japan');
Search countries
const searchCountriesList = stateCountry.searchCountries('ja');
Search states
const searchStatesList = stateCountry.searchStates('north');
Search states in a given country
const searchStatesInCountryList = stateCountry.searchStatesInCountry('north', 'united states');
Country and state data from: https://github.com/dr5hn/countries-states-cities-database. A refresh.js script is included to easily update the countries and states json files with the latest data from countries-states-cities-database.
FAQs
Get countries and states from across the world
The npm package state-country receives a total of 254 weekly downloads. As such, state-country popularity was classified as not popular.
We found that state-country demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.