Reference · Country names and groups
countryByCodefunction
The country with this code (upper or lower case), or undefined.
Import it
import { countryByCode } from "@johnmorrisdotca/chizu/names";
Definition
function countryByCode(code: string): ChizuCountry | undefined
Parameters
| Name | Type | Description |
|---|---|---|
code | string | The native region or country code; null clears a region selection where accepted. |
Returns
ChizuCountry | undefined
The matching country, or undefined when the code is unknown.
Examples
import { countryByCode } from "@johnmorrisdotca/chizu/names";
const japan = countryByCode("jp")!;
console.log(japan.name, japan.nameJa, japan.reading, japan.hasDivisions);
// Japan 日本 にほん trueJapan 日本 にほん trueWhat it prints (run when this page was built)