@genyus/country-code
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/genyus__country-code package

1.0.3 • Public • Published

country-code

npm version Build Status

Country Code utility Library

Features

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

Package Sidebar

Install

npm i @genyus/country-code

Weekly Downloads

108

Version

1.0.3

License

MIT

Unpacked Size

37.7 kB

Total Files

5

Last publish

Collaborators

  • lwhiteley