countries-list vs country-code-lookup vs country-data vs country-list vs i18n-iso-countries
Country Data Libraries
countries-listcountry-code-lookupcountry-datacountry-listi18n-iso-countriesSimilar Packages:

Country Data Libraries

These libraries provide various functionalities for handling country-related data, including country names, codes, and additional metadata. They are essential for applications that require geographical information, localization, and internationalization. Each library has its unique features and use cases, making them suitable for different scenarios in web development.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
countries-list01,308274 kB9a month agoMIT
country-code-lookup08761.4 kB58 days agoMIT
country-data0518-359 years agoMIT
country-list028216.9 kB17 months agoMIT
i18n-iso-countries0893624 kB54a year agoMIT

Feature Comparison: countries-list vs country-code-lookup vs country-data vs country-list vs i18n-iso-countries

Data Coverage

  • countries-list:

    Countries-list provides a comprehensive dataset that includes country names, ISO 3166-1 alpha-2 and alpha-3 codes, currencies, and calling codes. It covers all recognized countries and territories, making it suitable for applications needing extensive geographical data.

  • country-code-lookup:

    Country-code-lookup focuses on providing a quick reference for country codes and names. It includes a limited dataset primarily aimed at fast lookups, which may not be suitable for applications needing detailed country information.

  • country-data:

    Country-data offers a rich dataset that includes country names, ISO codes, languages, currencies, and region information. It is ideal for applications that require detailed country profiles and extensive metadata for each country.

  • country-list:

    Country-list provides a simple list of country names paired with their ISO codes. It is straightforward and does not include additional metadata, making it suitable for applications that only require basic country identification.

  • i18n-iso-countries:

    I18n-iso-countries specializes in providing localized country names in various languages. It is particularly useful for applications that need to display country names based on the user's language preference.

Localization Support

  • countries-list:

    Countries-list does not provide localization support directly but can be used alongside other libraries to implement localization features in your application.

  • country-code-lookup:

    Country-code-lookup lacks built-in localization support, focusing instead on quick access to country codes and names without additional features.

  • country-data:

    Country-data includes some localization features, particularly in terms of languages spoken in each country, making it useful for applications that require basic localization.

  • country-list:

    Country-list does not support localization and is designed for applications that only need country names and ISO codes without any localization features.

  • i18n-iso-countries:

    I18n-iso-countries excels in localization, providing country names in multiple languages. This makes it the best choice for applications that need to cater to a global audience with varying language preferences.

Ease of Use

  • countries-list:

    Countries-list is user-friendly and easy to integrate into applications. Its structure allows developers to quickly access the necessary data without complex configurations.

  • country-code-lookup:

    Country-code-lookup is designed for simplicity and speed, making it easy to implement for quick lookups without additional overhead.

  • country-data:

    Country-data is slightly more complex due to its extensive dataset, but it is still manageable for developers familiar with handling larger data structures.

  • country-list:

    Country-list is extremely straightforward, providing a simple API for accessing country names and codes, making it ideal for beginners.

  • i18n-iso-countries:

    I18n-iso-countries is easy to use, especially for developers familiar with localization practices. Its API is intuitive for retrieving localized country names.

Performance

  • countries-list:

    Countries-list is optimized for performance, allowing for quick access to country data without significant overhead, making it suitable for high-performance applications.

  • country-code-lookup:

    Country-code-lookup is lightweight and designed for fast lookups, ensuring minimal performance impact when retrieving country information.

  • country-data:

    Country-data may have a larger footprint due to its extensive dataset, but it is still efficient for most applications that require detailed country information.

  • country-list:

    Country-list is highly performant due to its simplicity, providing quick access to country names and codes without additional processing.

  • i18n-iso-countries:

    I18n-iso-countries performs well in retrieving localized names, but performance may vary depending on the number of languages supported in the application.

Community and Maintenance

  • countries-list:

    Countries-list has a strong community and is actively maintained, ensuring that the data remains up-to-date and reliable for developers.

  • country-code-lookup:

    Country-code-lookup is less frequently updated but still maintained, making it a stable choice for applications that do not require frequent changes.

  • country-data:

    Country-data is well-maintained with regular updates, ensuring that the dataset remains relevant and accurate for developers.

  • country-list:

    Country-list is maintained but may not receive frequent updates, making it suitable for applications that do not require constant changes to country data.

  • i18n-iso-countries:

    I18n-iso-countries has a vibrant community and is regularly updated, making it a reliable choice for applications needing localized country names.

How to Choose: countries-list vs country-code-lookup vs country-data vs country-list vs i18n-iso-countries

  • countries-list:

    Choose countries-list if you need a comprehensive list of countries with their ISO codes and additional information like currency and calling codes. It is well-structured and easy to use for applications that require extensive country data.

  • country-code-lookup:

    Select country-code-lookup if your primary need is to quickly retrieve country information based on ISO codes. This package is lightweight and efficient for applications that require fast lookups without additional metadata.

  • country-data:

    Opt for country-data if you need a rich dataset that includes not only country names and codes but also languages, currencies, and region information. It is ideal for applications that require detailed country profiles and localization support.

  • country-list:

    Use country-list for a simple and straightforward list of country names and their ISO codes. This package is perfect for basic applications that need to display country names without extra data or complexity.

  • i18n-iso-countries:

    Choose i18n-iso-countries if you require localized country names in multiple languages. This library is particularly useful for international applications that need to display country names based on the user's locale.

README for countries-list

Countries, Languages & Continents data

Monthly Downloads NPM Packagist CI: JS CI: PHP Twitter

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.

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.

Everything is strongly typed so you can easily use data with auto-complete in your IDE.

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

Installation

Package is available via:

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

Usage (version 3.x)

Module exports continents, countries, languages and utility functions.

// 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.

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

  • 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.

Everything in dist is generated, so please make data related changes ONLY to files from packages/countries, commit them. Use bun run build (or turbo build, turbo test) 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.