
Country Info Helper is a tiny and fast JavaScript/TypeScript library that provides easy access to comprehensive country data.
You can get information like country names, codes, capitals, languages, regions, borders, maps, currencies, and more with just a few lines of code.
Can be helpful for developers who are building a world map, international e-commerce site, or language learning app.
How to use it:
1. Install and import needed modules from the Country Info Helper.
# Yarn $ yarn @country-info-helper/common # NPM $ npm i @country-info-helper/common
import {
getCountOfCountries,
getCountryNames,
getCountryCodes,
getCapitalCities,
getAllLanguages,
getCountriesInRegion,
getFlagUrl,
getDialingCode,
getCountriesSharingBorders,
isCountryLandlocked,
getTopLevelDomain,
getMapUrls,
getCoatOfArmsUrls,
getEmoji,
getUnicode,
getAlpha3Code,
getNativeNames,
getCountryArea,
getNumericCode,
getCountryCurrencies,
getDialingCodeAndFlagUrl,
getAllDialingCodeAndFlagUrl,
getStatesByCountryCode,
getStatesByCountryName,
getStatesByAlpha3Code,
getCitiesByCountryCode,
getCitiesByCountryName,
getCitiesByAlpha3Code,
getCitiesByStateName
} from '@country-info-helper/common/build/src';2. The library offers a plethora of other functionalities which you can explore and implement as per your project’s requirement. Each method is designed to provide specific data, ensuring that you have all the country-related information you might need, right at your fingertips:
// Get total number of countries
const count = getCountOfCountries();
// Get a list of country names
const names = getCountryNames();
// Get list of country codes
const codes = getCountryCodes();
// Get capital cities
const capitals = getCapitalCities();
// Get languages spoken
const languages = getAllLanguages();
// Get countries in a region
const region = 'Europe';
const countries = getCountriesInRegion(region);
// Get country flag by code
const flagUrl = getFlagUrl('US');
// Get dialing code
const dialingCode = getDialingCode('FR');
// Get border countries
const borders = getCountriesSharingBorders('CA');
// Check if landlocked
const isLandlocked = isCountryLandlocked('AT');
// Get top level domain
const tld = getTopLevelDomain('JP');
// Get map URLs
const mapUrls = getMapUrls('AU');
// Get coat of arms URLs
const coatOfArms = getCoatOfArmsUrls('BR');
// Get emoji
const emoji = getEmoji('DE');
// Get Unicode
const unicode = getUnicode('IT');
// Get Alpha-3 code
const alpha3 = getAlpha3Code('CN');
// Get native names
const nativeNames = getNativeNames('ES');
// Get area
const area = getCountryArea('RU');
// Get numeric code
const numericCode = getNumericCode('IN');
// Get currencies
const currencies = getCountryCurrencies('GB');
// Get dialing code and flag URL
const countryInfo = getDialingCodeAndFlagUrl('ZA');
// Get all dialing codes and flag URLs
const countryInfo = getAllDialingCodeAndFlagUrl();
// Get states/provinces
const states = getStatesByCountryCode('US');
// Get cities
const cities = getCitiesByCountryName('Australia');
// Get states
const states = getStatesByAlpha3Code('DEU');
// Get cities
const cities = getCitiesByCountryCode('FR');
// Get cities
const cities = getCitiesByCountryName('countryName');
// Get cities by Alpha3 code
const cities = getCitiesByAlpha3Code('USA');
// Get cities
const cities = getCitiesByStateName('California');






