本文へ移動

Kuni国

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

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

目次

リファレンス · すべての行政区画

subdivisionByShortCode関数

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

One subdivision by its country and the part of its code after the hyphen.

インポート

import { subdivisionByShortCode } from "@johnmorrisdotca/kuni/subdivisions";

定義

function subdivisionByShortCode(countryCode: string, shortCode: string): Subdivision | null

引数

名前型説明
countryCodestring

An alpha-2 code, either case.

shortCodestring

The part after the hyphen: "ON", "13".

戻り値

Subdivision | null

The subdivision, frozen; null where the two make no code.

例

import { subdivisionByShortCode } from "@johnmorrisdotca/kuni/subdivisions";

console.log(subdivisionByShortCode("CA", "ON")?.code);   // "CA-ON"
console.log(subdivisionByShortCode("JP", "99"));         // null
CA-ON
null

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

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

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