Coder Social home page Coder Social logo

menaiala / countries Goto Github PK

View Code? Open in Web Editor NEW

This project forked from annexare/countries

0.0 0.0 0.0 1.98 MB

Countries, Languages & Continents data (capital and currency, native name, calling codes).

Home Page: https://annexare.github.io/Countries/

License: MIT License

JavaScript 100.00%

countries's Introduction

Countries, Languages & Continents data

Monthly Downloads NPM Packagist GitHub CI Travis CI Twitter

Continents & countries: ISO 3166-1 alpha-2 code (with alpha-2 to alpha-3 set), name, ISO 639-1 languages, capital and currency, native name, calling codes. Lists are available in JSON, CSV and SQL formats. Also, contains separate JSON files with additional country Emoji flags data.

Version 2.0: Breaking changes

This version changes a lot in the data structures, and placement of the files. So, if your projects depend on the old structure — specify previous versions, <2.0.0.

Installation

Package is available via:

  • NPM npm install countries-list
  • Composer / Packagist composer require annexare/countries-list
  • Bower bower install countries

Usage

Module exports continents, countries, languages, languagesAll and functions:

  • getEmojiFlag(countryCode), where countryCode is alpha-2 String
  • getUnicode(emoji), where emoji is alpha-2 emoji flag String

Built files are in the ./dist directory. The ./data directory contains source data.

The consistent data is available from ./dist/data.* files (JSON, SQL).

Note: ES5 UMD build is here: ./dist/index.es5.min.js.

Note: Country item languages field is an Array in JSON files to easily count and match items with a Language item. But currency and phone calling codes may be a comma-separated String.

Note: Languages list only contains languages used in Countries data. Full list of known languages is exported as languagesAll from ./dist/languages.all.json.

Data example

{
  "continents": {
    "AF": "Africa",
    "AN": "Antarctica",
    "AS": "Asia",
    "EU": "Europe",
    "NA": "North America",
    "OC": "Oceania",
    "SA": "South America"
  },
  "countries": {
    "AE": {
      "name": "United Arab Emirates",
      "native": "دولة الإمارات العربية المتحدة",
      "phone": "971",
      "continent": "AS",
      "capital": "Abu Dhabi",
      "currency": "AED",
      "languages": [
        "ar"
      ],
      "emoji": "🇦🇪",
      "emojiU": "U+1F1E6 U+1F1EA"
    },
    ...
    "UA": {
      "name": "Ukraine",
      "native": "Україна",
      "phone": "380",
      "continent": "EU",
      "capital": "Kyiv",
      "currency": "UAH",
      "languages": [
        "uk"
      ],
      "emoji": "🇺🇦",
      "emojiU": "U+1F1FA U+1F1E6"
    }
  },
  "languages": {
    "ar": {
      "name": "Arabic",
      "native": "العربية",
      "rtl": 1
    },
    ...
    "uk": {
      "name": "Ukrainian",
      "native": "Українська"
    }
  }
}

Contributing

Everything is generated from files in ./data/, including SQL file.

Everything in ./dist/ is generated, so please make data related changes ONLY to files from ./data/, commit them. Use npm run build command to build/test generated files.

Credits

Prepared by Annexare Studio from different public sources. Feel free to use it as you need in your apps or send updates into this public repository. It's under MIT license.

countries's People

Contributors

aetonsi avatar bitofgold avatar cperez87 avatar dependabot[bot] avatar dmythro avatar erikdju avatar joakim avatar michaeljamie avatar orkhan avatar vsulak avatar z-ax 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.