https://github.com/richorama/country-code-lookup
:earth_africa: Finds countries by various country codes
https://github.com/richorama/country-code-lookup
countries country-codes lookup
Last synced: 4 days ago
JSON representation
:earth_africa: Finds countries by various country codes
- Host: GitHub
- URL: https://github.com/richorama/country-code-lookup
- Owner: richorama
- License: mit
- Created: 2014-08-27T10:54:18.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2024-06-25T23:19:35.000Z (over 1 year ago)
- Last Synced: 2025-03-29T02:08:26.766Z (6 months ago)
- Topics: countries, country-codes, lookup
- Language: JavaScript
- Homepage:
- Size: 93.8 KB
- Stars: 88
- Watchers: 3
- Forks: 29
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/country-code-lookup)

[](https://npmcharts.com/compare/country-code-lookup?minimal=true)# Country Code Lookup
A node.js module to look up countries by various country codes.
Supported codes:
* FIPS 10-4 codes (2 digits)
* ISO 3166 (2 digits)
* ISO 3166 (3 digits)
* ISO 3166 (numbers)
* Internet codes## Installation
```
$ npm install country-code-lookup
```## Usage
```js
const lookup = require('country-code-lookup')// search by FIPS
lookup.byFips('UK')// search by ISO
lookup.byIso('GB')
lookup.byIso('GBR')
lookup.byIso(826)// search by internet code
lookup.byInternet('UK')// search by country name
lookup.byCountry('United Kingdom')// get an array of all countries
lookup.countries
```Searching for a country will return either null, or a country object:
```js
{ continent: 'Europe',
region: 'Western Europe',
country: 'United Kingdom',
capital: 'London',
fips: 'UK',
iso2: 'GB',
iso3: 'GBR',
isoNo: '826',
internet: 'UK' }
````## Useful Links
ISO 2 and 3 digit country codes: https://www.iban.com/country-codes
## License
MIT