Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@genyus/country-code

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

@genyus/country-code

Country Data utility Library, ISO Codes etc...

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

country-code

npm version Build Status

Country Code utility Library

Features

  • English name of the Country
  • ISO 3166-1 Country number
  • ISO 3166-3 Country Codes
  • ISO 3166-2 Alpha 2 Country Codes

Installation

$ npm install @genyus/country-code

Usage

const cc = require('@genyus/country-code');
cc.find({ name: 'Algeria' });
// { name: 'Algeria',
//   alpha2: 'DZ',
//   alpha3: 'DZA',
//   isoNumeric: '012' }

cc.countries.DZA.name; // 'Algeria'

cc.countries.GBR.isoNumeric; //'826'

// nameIncludes
/**
 * options.accuracy {Number}: number from 0 - 1, a percentage of accuracy for the search,
 *                                  default (1 [exactly includes])
 **/
cc.nameIncludes('Trinidad', { accuracy: 0.7 });
/**
 [
  {
    name: 'Trinidad and Tobago',
    alpha2: 'TT',
    alpha3: 'TTO',
    isoNumeric: '780',
  },
 ]
 **/

Notes:

Breaking changes:

  • some country names were renamed with the original values put in a property called countryName

Keywords

country

FAQs

Package last updated on 16 May 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