Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

country-list

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country-list

Maps ISO 3166-1-alpha-2 codes to English country names and vice versa.

  • 2.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
200K
decreased by-3.14%
Maintainers
1
Weekly downloads
 
Created

What is country-list?

The country-list npm package provides a simple way to get a list of countries and their corresponding ISO 3166-1 alpha-2 codes. It is useful for applications that need to display country names, validate country codes, or convert between country names and codes.

What are country-list's main functionalities?

Get all countries

This feature allows you to retrieve a list of all countries along with their ISO 3166-1 alpha-2 codes.

const countries = require('country-list')().getData();
console.log(countries);

Get country name by code

This feature allows you to get the name of a country by providing its ISO 3166-1 alpha-2 code.

const countryList = require('country-list')();
const countryName = countryList.getName('US');
console.log(countryName);

Get country code by name

This feature allows you to get the ISO 3166-1 alpha-2 code of a country by providing its name.

const countryList = require('country-list')();
const countryCode = countryList.getCode('United States');
console.log(countryCode);

Add a custom country

This feature allows you to add a custom country to the list with a specified code and name.

const countryList = require('country-list')();
countryList.add({ code: 'XX', name: 'New Country' });
console.log(countryList.getData());

Remove a country

This feature allows you to remove a country from the list by providing its ISO 3166-1 alpha-2 code.

const countryList = require('country-list')();
countryList.remove('XX');
console.log(countryList.getData());

Other packages similar to country-list

Keywords

FAQs

Package last updated on 04 Dec 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc