Optionallocation: stringTwo-letter country code (e.g. "US"); undefined yields undefined
The full country name, or undefined when the code is missing/unknown
getCountryName("US") // "United States"
getCountryName("GB") // "United Kingdom"
getCountryName(undefined) // undefined
export function getCountryName(location?: string): string | undefined {
if (!location) {
return undefined;
}
return findCountryByIso2(location)?.name;
}
Resolves the full country name for a two-letter location code.