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

country-code-lookup

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country-code-lookup

Finds countries by various country codes

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
117K
increased by9.37%
Maintainers
1
Weekly downloads
 
Created
Source

NPM version Downloads

Country Code Lookup

A node.js module to look up countries by various country codes.

Supported codes:

  • FIPS 10-4 codes (2 digits)
  • ISO 3166 (2 digits)
  • ISO 3166 (3 digits)
  • ISO 3166 (numbers)
  • Internet codes

Installation

$ npm install country-code-lookup

Usage

const lookup = require('country-code-lookup')

// search by FIPS
lookup.byFips('UK')

// search by ISO
lookup.byIso('GB')
lookup.byIso('GBR')
lookup.byIso(826)

// search by internet code
lookup.byInternet('UK')

// search by country name
lookup.byCountry('United Kingdom')

// get an array of all countries
lookup.countries

Searching for a country will return either null, or a country object:

{ continent: 'Europe',
  region: 'Western Europe',
  country: 'United Kingdom',
  capital: 'London',
  fips: 'UK',
  iso2: 'GB',
  iso3: 'GBR',
  isoNo: '826',
  internet: 'UK' }

ISO 2 and 3 digit country codes: https://www.iban.com/country-codes

License

MIT

Keywords

FAQs

Package last updated on 30 Apr 2024

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