country-codes-and-flags
Version:
A TypeScript library mapping country names and ISO codes to their corresponding flag emoji
51 lines (48 loc) • 1.7 kB
text/typescript
type CountryMetadata = {
flag: string;
alpha2: string;
alpha3: string;
};
/**
* Get the flag emoji given a country's name
*/
declare const getFlagByCountry: (country: string) => string | null;
/**
* Get the flag emoji given a country's two-letter country code
*/
declare const getFlagByAlpha2: (isoCode: string) => string | null;
/**
* Get the flag emoji given a country's three-letter country code
*/
declare const getFlagByAlpha3: (isoCode: string) => string | null;
/**
* Get the two-letter country code given a country's name
*/
declare const getAlpha2ByCountry: (country: string) => string | null;
/**
* Get the three-letter country code given a country's name
*/
declare const getAlpha3ByCountry: (country: string) => string | null;
/**
* Get a country's name given it's associated flag emoji string
*/
declare const getCountryFromFlag: (flag: string) => string | null;
/**
* Get a country's name given it's associated two-letter country code
*/
declare const getCountryByAlpha2: (isoCode: string) => string | null;
/**
* Get a country's name given it's associated three-letter country code
*/
declare const getCountryByAlpha3: (isoCode: string) => string | null;
/**
* Get a country's name flag, alpha2, and alpha3 codes given the country's name
*/
declare const getAllByCountry: (country: string) => CountryMetadata | null;
/**
* Get full dataset of countries mapped to their flag and iso codes
*/
declare const getAll: () => {
[key: string]: CountryMetadata;
};
export { getAll, getAllByCountry, getAlpha2ByCountry, getAlpha3ByCountry, getCountryByAlpha2, getCountryByAlpha3, getCountryFromFlag, getFlagByAlpha2, getFlagByAlpha3, getFlagByCountry };