The value to validate
Type predicate indicating if the value is a valid country code
isCountryCode("US") // true
isCountryCode("ZZ") // false
isCountryCode(undefined) // false
export function isCountryCode(country: unknown): country is CountryCode {
return typeof country === 'string' && findCountryByIso2(country) !== undefined;
}
Type guard to validate if a value is a known ISO 3166-1 alpha-2 country code. Checks the value against
country-list-jsso any real country code is accepted.