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 · Places: countries of a continent, and search (the size counts every tier)

cityNamesOffunction

A country's cities, ids and names only: the light list a picker shows first (a third to a half of the country's full file), in the order of citiesOf, each with major for the country's capital and its first twenty cities. The rest of a city is one cityById away.

Import it

import { cityNamesOf } from "@johnmorrisdotca/kuni/places";

Definition

function cityNamesOf(code: string): Promise<readonly CityName[] | null>

Parameters

NameTypeDescription
codestring

An ISO 3166-1 alpha-2 code, any case.

Returns

Promise<readonly CityName[] | null>

The list, or null for a code with no cities.

Examples

import { cityNamesOf } from "@johnmorrisdotca/kuni/places";

const japan = await cityNamesOf("JP");
console.log(japan?.[0].name.en);                          // "Tokyo"
console.log(japan?.filter((one) => one.major).length);   // 20
Tokyo
20

What it prints (run when this page was built)

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