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 · Cities: lookups and loading (the tiers load on demand; the size counts every tier)

citiesOffunction

One country's cities, every tier together, the most populous first: the same list as

Import it

import { citiesOf } from "@johnmorrisdotca/kuni/cities";

Definition

function citiesOf(countryCode: string): Promise<readonly City[] | null>

Parameters

NameTypeDescription
countryCodestring

An ISO 3166-1 alpha-2 code, in either case.

Returns

Promise<readonly City[] | null>

The list, frozen; an empty list for a country with no city in the data; null for a code that is not a country.

Examples

import { citiesOf } from "@johnmorrisdotca/kuni/cities";

const japan = await citiesOf("jp");
console.log(japan?.[0].country);          // "JP"
console.log(japan?.some((one) => one.capital === "national")); // true
console.log(await citiesOf("XX")); // null
JP
true
null

What it prints (run when this page was built)

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