countryByCode関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The country with this code (upper or lower case), or undefined.
インポート
import { countryByCode } from "@johnmorrisdotca/chizu/names";
定義
function countryByCode(code: string): ChizuCountry | undefined
引数
| 名前 | 型 | 説明 |
|---|---|---|
code | string | The native region or country code; null clears a region selection where accepted. |
戻り値
ChizuCountry | undefined
The matching country, or undefined when the code is unknown.
例
import { countryByCode } from "@johnmorrisdotca/chizu/names";
const japan = countryByCode("jp")!;
console.log(japan.name, japan.nameJa, japan.reading, japan.hasDivisions);
// Japan 日本 にほん trueJapan 日本 にほん true出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。