https://github.com/podviaznikov/country.js
Minor utility library allowing us to get ISO code for country.
https://github.com/podviaznikov/country.js
Last synced: about 2 months ago
JSON representation
Minor utility library allowing us to get ISO code for country.
- Host: GitHub
- URL: https://github.com/podviaznikov/country.js
- Owner: podviaznikov
- Created: 2011-08-04T11:56:15.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2015-01-06T08:18:43.000Z (over 10 years ago)
- Last Synced: 2025-03-27T06:51:14.489Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 119 KB
- Stars: 7
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#country.js
Introduces new global object: Country.
Now it's only possible to get ISO-3166-1 code for each country using it's full name.
Mapping was taken from Wikipedia (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
on Aug 4, 2011.
However it's better to synchronize this with http://www.iso.org/iso/list-en1-semic-3.txt.
Library can be used both in browser or on server as NPM module.
```
npm install country
```How to use:
```javascript
var country = require('country');
console.log(country['Ukraine']);//should print UA
```