Skip to the content

Kuni国

Look up countries, codes, names and subdivisions, load country data on demand and mount a native country card.

Kuni (国) is Japanese for a country. About the name

Contents

Reference · All subdivisions

subdivisionByShortCodefunction

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

Import it

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

Definition

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

Parameters

NameTypeDescription
countryCodestring

An alpha-2 code, either case.

shortCodestring

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

Returns

Subdivision | null

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

Examples

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

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

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kuni 1.4.0.