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
引数
| 名前 | 型 | 説明 |
|---|---|---|
countryCode | string | An alpha-2 code, either case. |
shortCode | string | 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")); // nullCA-ON
null出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。