@tumbati/countries-metadata
v0.0.6
Published
List of countries containing country code, currency, dial code, continent, capital, and flags.
Maintainers
Readme
countries-metadata
List of countries containing country code, currency, dial code, continent, capital, and flags.
Purpose
The purpose of this repository is to provide a detailed list of country metadata, encompassing essential information for each country. The metadata includes:
- Country code: A unique code assigned to each country.
- Flag emoji: Emoji representation of the country's flag.
- Country name: The name of the country.
- Dial code: The international dialing code for the country.
- Currency code: The code representing the country's currency.
- Continent: The continent to which the country belongs.
- Capital: The capital city of the country.
This data is stored in countries_metadata.json and can be utilized in various applications that require country-related information.
Installation
npm:
npm install @tumbati/countries-metadatapnpm:
pnpm add @tumbati/countries-metadatayarn:
yarn add @tumbati/countries-metadataUsage
Import the package
import { countries, type Country, findCountryByCode, getCountryByName, findCountriesByContinent } from "@tumbati/countries-metadata";Access all countries
An array containing metadata about various countries.
import { countries, type Country } from "@tumbati/countries-metadata";
console.log(countries); // Array of all countriesFind a country by its code
import { findCountryByCode } from "@tumbati/countries-metadata";
const country = findCountryByCode('MW');
console.log(country); // { code: 'MW', name: 'Malawi', ... }Get a country by its name
import { getCountryByName } from "@tumbati/countries-metadata";
const country = getCountryByName('Malawi');
console.log(country); // { code: 'MW', name: 'Malawi', ... }Find countries in a specific continent
import { findCountriesByContinent } from "@tumbati/countries-metadata";
const africanCountries = findCountriesByContinent('Africa');
console.log(africanCountries); // Array of all African countriesTypeScript Support
The package includes full TypeScript support with type definitions:
import { type Country } from "@tumbati/countries-metadata";
const myCountry: Country = {
code: 'US',
flag: '🇺🇸',
name: 'United States',
dial_code: '+1',
currency_code: 'USD',
continent: 'North America',
capital: 'Washington, D.C.'
};Data Sources
The country data, including continent and capital information, was sourced from this Gist by tiagodealmeida. The original data was enriched by integrating additional details like dial codes and currency codes.
The flag emojis used in the metadata were sourced from the country-flag-emoji-json repository by Risan.
How the Data was Generated
The countries_metadata.json file was generated by processing data from the country-flag-emoji-json repository and augmenting it with information sourced from tiagodealmeida's Gist. This resulted in a comprehensive dataset containing various details for each country.
Contributing
If you have additional information or updates to the country metadata, feel free to contribute to this repository by submitting a pull request.
License
This repository is licensed under the MIT License.
