@genyus/country-code
v1.0.3
Published
Country Data utility Library, ISO Codes etc...
Downloads
51
Readme
country-code
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:
- fork and update of country-code
- pull requests welcome
Breaking changes:
- some country names were renamed with the original values put in a property called
countryName