https://github.com/ecrmnn/iso-3166-1
🇳🇴  Lookup information with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3 and ISO 3166-1 numeric
https://github.com/ecrmnn/iso-3166-1
country iso-3166-1 iso3166 lookup-information
Last synced: 2 months ago
JSON representation
🇳🇴  Lookup information with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3 and ISO 3166-1 numeric
- Host: GitHub
- URL: https://github.com/ecrmnn/iso-3166-1
- Owner: ecrmnn
- Created: 2016-03-09T17:03:32.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-13T11:36:38.000Z (over 1 year ago)
- Last Synced: 2025-03-31T18:21:18.136Z (3 months ago)
- Topics: country, iso-3166-1, iso3166, lookup-information
- Language: TypeScript
- Homepage: https://www.npmjs.com/iso-3166-1
- Size: 46.9 KB
- Stars: 57
- Watchers: 4
- Forks: 12
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# iso-3166-1
> Lookup information with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3 and ISO 3166-1 numeric[](https://travis-ci.org/ecrmnn/iso-3166-1)
[](http://badge.fury.io/js/iso-3166-1)
[](http://badge.fury.io/js/iso-3166-1)
[](http://badge.fury.io/js/iso-3166-1)### Installation
```bash
npm install iso-3166-1 --save
```### Usage
Get country by ISO 3166-1 Alpha-2
```javascript
const iso = require('iso-3166-1');console.log(iso.whereAlpha2('no'));
/** Returns:
{
country: 'Norway',
alpha2: 'NO',
alpha3: 'NOR',
numeric: '578'
}
*/
```Get country by ISO 3166-1 Alpha-3
```javascript
const iso = require('iso-3166-1');console.log(iso.whereAlpha3('nor'));
/** Returns:
{
country: 'Norway',
alpha2: 'NO',
alpha3: 'NOR',
numeric: '578'
}
*/
```Get country by ISO 3166-1 Numeric
```javascript
const iso = require('iso-3166-1');console.log(iso.whereNumeric(578));
/** Returns:
{
country: 'Norway',
alpha2: 'NO',
alpha3: 'NOR',
numeric: '578'
}
*/
```Get country by country name
```javascript
const iso = require('iso-3166-1');console.log(iso.whereCountry('NORWAY'));
/** Returns:
{
country: 'Norway',
alpha2: 'NO',
alpha3: 'NOR',
numeric: '578'
}
*/
```Get all countries
```javascript
const iso = require('iso-3166-1');console.log(iso.all());
/** Returns:
[
{
country: 'Norway',
alpha2: 'NO',
alpha3: 'NOR',
numeric: '578'
}
]
*/
```### License
MIT © [Daniel Eckermann](http://danieleckermann.com)