easy-countries-list
v1.1.0
Published
Easy countries list manager
Downloads
21
Readme
Easy Countries List
This package is a easy standar countries list.
Salesforce and Zuora used this countries list.
Installation
npm i --save easy-countries-list
Usage
Function:
Get all countries:
import EasyCountriesList from 'easy-countries-list';
const countries = EasyCountriesList.getAllCountries();
Return object:
[
{...},
{
name: 'United States',
countryCode: 'US' // ISO alpha-2
},
{...}
]
Filter by Country Name:
import EasyCountriesList from 'easy-countries-list';
const countries = EasyCountriesList.filterByCountryName('united states');
Return object:
{
name: 'United States',
countryCode: 'US', // ISO alpha-2
countryCodeThree: 'USA' // ISO alpha-3
}
Filter by Country Code:
import EasyCountriesList from 'easy-countries-list';
const countries = EasyCountriesList.filterByCountryCode('Us');
Return object:
{
name: 'United States',
countryCode: 'US', // ISO alpha-2
countryCodeThree: 'USA' // ISO alpha-3
}
Filter by Country Code Three:
import EasyCountriesList from 'easy-countries-list';
const countries = EasyCountriesList.filterByCountryCodeThree('Usa');
Return object:
{
name: 'United States',
countryCode: 'US', // ISO alpha-2
countryCodeThree: 'USA' // ISO alpha-3
}
Next Feature
- Add states list for US and Canada.