iso-3166-1-alpha-2
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/iso-3166-1-alpha-2 package

1.0.2 • Public • Published

#Iso-3155-1-alpha-2

Simple lookup interface for iso country codes to countries and reverse.

The only dependency is mout, so this module works both in node and in the browser(ify).

Installation

npm install iso-3166-1-alpha-2

Usage

var iso3311a2 = require('./iso-3166-1-alpha-2')

// Lookup country by code
console.log iso3311a2.getCountry("DE")    // "Germany"

// Lookup code by country
console.log iso3311a2.getCode("Germany")  // "DE"

// Get array of all country codes
console.log iso3311a2.getCodes()          // ["AF","AX","AL",...]

// Get array of all country names
console.log iso3311a2.getCountries()      // ["Afghanistan","Åland Islands","Albania",...]

// Get Object with code (key) to country (value) mappings
console.log iso3311a2.getData()           // { "AF" : "Afghanistan", .... }

Documentation

Docco annotated source is found here: (docs/index.html)

/iso-3166-1-alpha-2/

    Package Sidebar

    Install

    npm i iso-3166-1-alpha-2

    Weekly Downloads

    50,519

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    1.76 MB

    Total Files

    21

    Last publish

    Collaborators

    • georgzoeller