Get Country Information
const { getCountryInfo } = require('countrys-info');
// Get information about a specific country
const countryData = getCountryInfo('Afghanistan');
console.log(countryData);
// Get a specific field of a country
const capitalEn = getCountryInfo('China', 'capital_en');
console.log(capitalEn);
// Get multiple fields of a country
const countryFields = getCountryInfo('China', ['capital_en', 'code_2', 'tld']);
console.log(countryFields);Last updated