2017 © Pedro Peláez
 

library countries-list

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

image

annexare/countries-list

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

  • Friday, March 30, 2018
  • by z-ax
  • Repository
  • 7 Watchers
  • 197 Stars
  • 2,006 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 111 Forks
  • 4 Open issues
  • 20 Versions
  • 23 % Grown

The README.md

Countries, Languages & Continents data

Monthly Downloads NPM Packagist CI: JS CI: PHP Twitter, (*1)

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

Version 3.0: Breaking changes

Version 3 comes with some data structure changes. It was completely reworked under the hood with TypeScript, ESM exports and Turborepo file structure., (*3)

Everything is strongly typed so you can easily use data with auto-complete in your IDE., (*4)

Note: If your projects depend on the old structure, carefully specify required versions in your dependencies., (*5)

Installation

Package is available via:, (*6)

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

Usage (version 3.x)

Module exports continents, countries, languages and utility functions., (*7)

// Interfaces and types
import type {
  ICountry,
  ICountryData,
  ILanguage,
  TContinentCode,
  TCountryCode,
  TLanguageCode,
} from 'countries-list'

// Main data and utils
import { continents, countries, languages } from 'countries-list'
// Utils
import { getCountryCode, getCountryData, getCountryDataList, getEmojiFlag } from 'countries-list'

// Minimal data in JSON
import countries2to3 from 'countries-list/minimal/countries.2to3.min.json'
import countries3to2 from 'countries-list/minimal/countries.3to2.min.json'
import languageNames from 'countries-list/minimal/languages.native.min'

getCountryCode('Ukraine') // 'UA'
getCountryCode('Україна') // 'UA'
getCountryData('UA') // ICountryData

Built files are in the dist directory of this repository, and packages/countries directory contains source data., (*8)

Note: JS build contains ES modules, CommonJS and IIFE (for now), (*9)

  • CJS cjs/index.js
  • ESM mjs/index.js
  • IIFE index.iife.js

Data structure examples

const continents = {
  AF: 'Africa',
  AN: 'Antarctica',
  AS: 'Asia',
  EU: 'Europe',
  NA: 'North America',
  OC: 'Oceania',
  SA: 'South America',
}

const countries = {
  // ...
  UA: {
    name: 'Ukraine',
    native: 'Україна',
    phone: [380],
    continent: 'EU',
    capital: 'Kyiv',
    currency: ['UAH'],
    languages: ['uk'],
  },
  // ...
}

const languages = {
  // ...
  uk: {
    name: 'Ukrainian',
    native: 'Українська',
  },
  ur: {
    name: 'Urdu',
    native: 'اردو',
    rtl: 1,
  },
  // ...
}

Contributing to this repository

Everything is generated from strongly typed files in packages/countries/src, including SQL file., (*10)

Everything in dist is generated, so please make data related changes ONLY to files from packages/countries, commit them. Use npm run build (or turbo build, turbo test) command to build/test generated files., (*11)

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., (*12)

The Versions

30/03 2018

dev-master

9999999-dev http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

30/03 2018

2.3.2

2.3.2.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

30/03 2018

dev-langs-24

dev-langs-24 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

29/01 2018

2.3.1

2.3.1.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

29/01 2018

dev-es5_build_fix

dev-es5_build_fix http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

22/12 2017

2.3.0

2.3.0.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

22/12 2017

dev-add-d-ts

dev-add-d-ts http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

20/12 2017

2.2.1

2.2.1.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

24/10 2017

2.2.0

2.2.0.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

19/10 2017

2.1.1

2.1.1.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

06/10 2017

2.1.0

2.1.0.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

16/07 2017

2.0.0

2.0.0.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

07/06 2017

dev-add-languages

dev-add-languages http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital iso 639-1

15/05 2017

1.4.1

1.4.1.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.

  Sources   Download

MIT

sql csv json currency data languages country countries node emoji continent iso 3166-1 capital

08/05 2017

1.4.0

1.4.0.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.

  Sources   Download

MIT

sql csv json currency data languages country countries node continent iso 3166-1 capital

14/02 2017

1.3.2

1.3.2.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.

  Sources   Download

MIT

sql csv json currency data languages country countries node continent iso 3166-1 capital

12/02 2017

1.3.1

1.3.1.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.

  Sources   Download

MIT

sql csv json currency data languages country countries node continent iso 3166-1 capital

12/02 2017

1.3.0

1.3.0.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, languages, capital and currency, native name, calling codes. Available in JSON, CSV and SQL formats.

  Sources   Download

MIT

sql csv json currency data languages country countries node continent iso 3166-1 capital

25/03 2016

1.1.0

1.1.0.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, languages, capital and currency, native name, calling codes. Available in JSON and SQL formats.

  Sources   Download

MIT

sql json currency data languages country countries node continent iso 3166-1 capital

09/01 2016

1.0.4

1.0.4.0 http://annexare.github.io/Countries/

Continents & countries: ISO 3166-1 alpha-2 code, name, languages, capital and currency, native name, calling codes. Available in JSON and SQL formats.

  Sources   Download

MIT

sql json currency data languages country countries node continent iso 3166-1 capital