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

subdivisionsByNamefunction

Every subdivision a typed name could be, in code order: its English or Japanese name, its Japanese name without the word for its kind (オンタリオ, 東京), a prefecture's reading, or its full code. Folded as fold folds, so case, accents, width and kana do not matter.

Import it

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

Definition

function subdivisionsByName(text: string, options?: SubdivisionByNameOptions): readonly Subdivision[]

Parameters

NameTypeDescription
textstring

What was typed.

options (optional)SubdivisionByNameOptions

country and level, to narrow the search.

Returns

readonly Subdivision[]

The subdivisions it could be, frozen; an empty list for none.

Examples

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

console.log(subdivisionsByName("Punjab").map((one) => one.code));   // ["IN-PB", "PK-PB"]
console.log(subdivisionsByName("とうきょうと").map((one) => one.code)); // ["JP-13"]
console.log(subdivisionsByName("Narnia"));                          // []
[ 'IN-PB', 'PK-PB' ]
[ 'JP-13' ]
[]

What it prints (run when this page was built)

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