Giter Club home page Giter Club logo

african-countries's Introduction

African Countries NPM GitHub package.json version

A lightweight library of all the countries in Africa and their country codes (ISO Alpha-2 and Alpha-3)

Installation

npm install @odusanya/african-countries

Or you can install via yarn, run this line in your terminal:

yarn add @odusanya/african-countries

Usage

//  for ES6
import countriesInAfrica from '@odusanya/african-countries';

// for ES5
var countriesInAfrica = require('@odusanya/african-countries');

Basic Examples

  1. Console log countriesInAfrica to print a JSON Object containing all the countries in Africa and their respective country codes (ISO Alpha-2 and Alpha-3), in the format below:
  {
    [countryOneName]: {
      countryCode: {
        'alpha-2': CO,
        'alpha-3': CON
      }
    },
    [countryTwoName]: {
      countryCode: {
        'alpha-2': CT,
        'alpha-3': CTN
      }
    }
  }

2. Create an array of all the countries in Africa.
const countriesArray = [];
for (const countryName in africanCountries) {
	countriesArray.push(countryName);
}

3. Access the country code for specific countries, e.g `Nigeria`
console.log(africanCountries['nigeria'].countryCode);
// { alpha-2: 'NG', alpha-3: 'NGA' }

Roadmap

Next steps for this projects includes adding the following to the JSON Object

  • Country's Flag
    • Emoji
    • EmojiU
  • Capital
  • Language(s)
  • Dial Code
  • Currency

Contribution

Feel free to send a PR to fix, update or add new entry anytime.

african-countries's People

Contributors

odusanya avatar

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.