countryName関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A country's name in English or Japanese.
インポート
import { countryName } from "@johnmorrisdotca/kuni";
定義
function countryName(code: string, language?: Language, options?: CountryNameOptions): string | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
code | string | Any code |
language (省略可) | "en" | "ja" | "en" (the default) or "ja". |
options (省略可) | CountryNameOptions |
|
戻り値
string | null
The name; null for a code that is not a country, or a language that is not one of the two.
例
import { countryName } from "@johnmorrisdotca/kuni";
console.log(countryName("US")); // "United States"
console.log(countryName("US", "ja", { short: true })); // "アメリカ"
console.log(countryName("GB", "en", { short: true })); // "UK"
console.log(countryName("XX")); // nullUnited States
アメリカ
UK
null出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。