GithubHelp home page GithubHelp logo

ecrmnn / iso-3166-1 Goto Github PK

View Code? Open in Web Editor NEW
56.0 5.0 13.0 48 KB

🇳🇴  Lookup information with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3 and ISO 3166-1 numeric

Home Page: https://www.npmjs.com/iso-3166-1

TypeScript 100.00%
country lookup-information iso3166 iso-3166-1

iso-3166-1's Introduction

iso-3166-1

Lookup information with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3 and ISO 3166-1 numeric

Build Status npm version npm version npm version

Installation

npm install iso-3166-1 --save

Usage

Get country by ISO 3166-1 Alpha-2

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

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

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

const iso = require('iso-3166-1');

console.log(iso.whereCountry('NORWAY'));
/** Returns:
  {
    country: 'Norway',
    alpha2: 'NO',
    alpha3: 'NOR',
    numeric: '578'
  }
*/

Get all countries

const iso = require('iso-3166-1');

console.log(iso.all());
/** Returns:
  [
    {
      country: 'Norway',
      alpha2: 'NO',
      alpha3: 'NOR',
      numeric: '578'
    }
  ]
*/

License

MIT © Daniel Eckermann

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.