requireCountry()function
requireCountry(value?: unknown, caller: AnyCaller = requireCountry): Country
| Param | Type | |
|---|---|---|
value | unknown | The country code to parse, or "detect" to read it from the browser. |
caller | AnyCaller | Identity of the calling function for error attribution. Defaults to requireCountry |
| Throws | |
|---|---|
unknown | RequiredError If a country could not be resolved. |
Parse a country string, or detect a browser country from navigator.language, or throw RequiredError.
Examples
requireCountry("gb") // "GB"