1.1.3 ā€¢ Published 3 years ago

iso-country-utils v1.1.3

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

A helper to get country codes following the ISO 3316

Install

npm install iso-country-utils

or

yarn add iso-country-utils

Usage

This is the Country type:

type Country = {
  name: string;
  alpha2: string;
  alpha3: string;
  code: string;
};

You can get all the countries just calling

import { countries } from 'iso-country-utils';

You can get a country by its name with getCountryFromName:

import { getCountryFromName } from 'iso-country-utils';

const US = getCountryFromName('United States of America');

You can get a country by its alpha2 value with getCountryFromAlpha2:

import { getCountryFromAlpha2 } from 'iso-country-utils';

const US = getCountryFromAlpha2('US');

You can get a country by its alpha3 value with getCountryFromAlpha3:

import { getCountryFromAlpha3 } from 'iso-country-utils';

const US = getCountryFromAlpha3('USA');

You can get a country by its code with getCountryFromAlpha3:

import { getCountryFromCode } from 'iso-country-utils';

const US = getCountryFromCode('840');

You can find a full list of countries from the source

Author

šŸ‘¤ Pedro Filho pedro@filho.me

šŸ¤ Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

Show your support

Give a ā­ļø if this project helped you!

1.1.3

3 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago