本文へ移動

Kuni国

国、コード、名前、行政区画を調べ、必要なときに国のデータを読み込み、標準の国のカードを表示できます。

「国(くに)」は、国を表す日本語です。 名前について(英語)

目次

リファレンス · ISO 3166-1にない地域

reservedPlace関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

One place outside ISO 3166-1, by its code ("IC", "ic"), its three letters ("ASC") or its id ("somaliland").

インポート

import { reservedPlace } from "@johnmorrisdotca/kuni/reserved";

定義

function reservedPlace(text: string): ReservedPlace | null

引数

名前型説明
textstring

A code, in either case, or an id.

戻り値

ReservedPlace | null

The place, frozen; null for anything else, a country's code included.

例

import { reservedPlace } from "@johnmorrisdotca/kuni/reserved";

console.log(reservedPlace("IC")?.name.ja);            // "カナリア諸島"
console.log(reservedPlace("ea")?.subdivisions);       // ["ES-CE", "ES-ML"]
console.log(reservedPlace("AC")?.parent);             // "GB"
console.log(reservedPlace("somaliland")?.kind);       // "de-facto"
console.log(reservedPlace("JP"));                     // null
カナリア諸島
[ 'ES-CE', 'ES-ML' ]
GB
de-facto
null

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/kuni 1.19.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。