
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@data-sets/countries
Advanced tools
Static data-set of countries, with additional methods for convenience.
A static list of countries to use in your own projects & services.
import countries from '@data-sets/countries';
// or
// const countries = require('@data-sets/countries');
console.log(countries.findByCode('US'));
// { id: 'Q30',
// name: 'United States of America',
// iso2: 'US',
// iso3: 'USA',
// phonePrefix: '+1',
// currencyId: 'Q4917',
// currencyCode: 'USD',
// population: '331449281',
// latlon: [ '-98.5795', '39.828175' ],
// emergencyPhone: '911',
// internetTlds: [ '.us' ],
// continentId: 'Q49',
// continentName: 'North America',
// capitalId: 'Q61',
// capitalName: 'Washington, D.C.' }
console.log(countries.findByCode('GB'));
// { id: 'Q145',
// name: 'United Kingdom',
// iso2: 'GB',
// iso3: 'GBR',
// phonePrefix: '+44',
// currencyId: 'Q25224',
// currencyCode: 'GBP',
// population: '67326569',
// latlon: [ '-2.0', '54.6' ],
// emergencyPhone: '112',
// internetTlds: [ '.uk', '.gb' ],
// continentId: 'Q46',
// continentName: 'Europe',
// capitalId: 'Q84',
// capitalName: 'London' }
npm install --save @data-sets/countries
data
Import the complete list of countries, as an array, so you can filter
/find
/map
/reduce
as you please:
import { data } from '@data-sets/countries';
const selection = data.filter(({ currencyCode }) => {
return ['USD', 'GBP', 'EUR'].includes(currencyCode);
});
const countries = require('@data-sets/countries');
const selection = countries.data.filter(({ currencyCode }) => {
return ['USD', 'GBP', 'EUR'].includes(currencyCode);
});
findByCode
Get a country by their ISO 3166-1 alpha-2
or ISO 3166-1 alpha-3
code. Returns undefined
if the country is not found.
import { findByCode } from '@data-sets/countries';
const country = findByCode('US');
const countries = require('@data-sets/countries');
const country = countries.findByCode('USA');
FAQs
Static data-set of countries, with additional methods for convenience.
We found that @data-sets/countries demonstrated a not healthy version release cadence and project activity because the last version was released 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
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.