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

subdivisionfunction

One subdivision by its ISO 3166-2 code.

Import it

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

Definition

function subdivision(code: string): Subdivision | null

Parameters

NameTypeDescription
codestring

The full code, either case: "JP-13", "ca-on".

Returns

Subdivision | null

The subdivision, frozen; null for anything that is not one.

Examples

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

console.log(subdivision("JP-13")?.name.ja);   // "東京都"
console.log(subdivision("ca-on")?.name.en);   // "Ontario"
console.log(subdivision("FR-75C")?.parent);   // "FR-IDF"
console.log(subdivision("XX-99"));            // null
東京都
Ontario
FR-IDF
null

What it prints (run when this page was built)

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