Giter VIP home page Giter VIP logo

iso-countries's Introduction

ISO Country Codes

a little javascript helper

This library is a javascript version of the dataset originally published by Andrew Patton. This dataset merges information from ISO, United Nations and the CIA World Factbook.

By converting the dataset to javascript objects you can access commonly required information (name, currency etc) just using the two letter ISO 3166-1 alpha-2 code. Additional methods are available to search for countries by current, name, international telephone dialling prefix, top-level internet domain etc.

It works in both Node.js and the web browser.

Installation

For use in Node.js:

npm install iso-countries

In the browser just copy the file from dist\countries.min.js (skinny) or dist\countries.js (full-fat).

Building

To create distributable files:

npm install
make dist

To run the tests (requires mocha and should):

make test

To run everything

make all

Usage

TODO - add once finder methods are complete

See tests for now. Sorry.

License

MIT

Changes to the data

I've included a copy of the source data file isocountry_detailed.txt. If you believe updates are required pleases let me know. If you disagree with the United Nations or ISO on the status or name of a country then you should probably fork your own version (or this repo, not the country).

Notes

This library uses the reserved ISO 3166-1 alpha-2 code 'XX' to represent Worldwide. This might not be for everyone but it was consistent with my personal use cases. I'll probably add a build option to exclude this.

Future

  • Likely to split the browser version into two (regular and light) so that more fields such as population and local names can be included.

  • Provide CSS files for flags

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.