Reference · Countries and lookup tools
flagfunction
The flag of a country as an emoji: two regional-indicator letters, which most systems draw as the flag and some (Windows) as the two letters. Write the country's name beside it.
Import it
import { flag } from "@johnmorrisdotca/kuni";
Definition
function flag(code: string): string | null
Parameters
| Name | Type | Description |
|---|---|---|
code | string | Any code |
Returns
string | null
The emoji; null for a code that is not a country.
Examples
import { flag } from "@johnmorrisdotca/kuni";
console.log(flag("JP")); // "🇯🇵"
console.log(flag("XX")); // null🇯🇵
nullWhat it prints (run when this page was built)