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)

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

1493.8 kB minified and gzipped, with everything it imports (measured with esbuild)

Exports

NameKindWhat it is
citiesOffunctionOne country's cities, every tier together, the most populous first: the same list as
CitytypeOne city, as every tier hands it out (frozen): plain numbers and codes, null where no source has the fact.
CITY_TIERSconstantThe names of the four tiers, in the order of their size.
CityAttypeA city and how far it is from the point asked about.
cityByIdfunctionOne city, by its id: a Wikidata item ("Q90") or "ne:<number>", in either case; an id that was merged into another city answers with the city it became.
citySetfunctionJoins lists of cities (a tier's list, or several) into one set with the lookups built once.
CitySettypeCities joined for lookups: by id, by country, by subdivision and by nearness.
CitySourcetypeWhich input a fact in a city's record came from.
CityTiertypeThe four tiers, smallest first: capitals (every capital, of a country or a subdivision, of any size), 1m (the other cities of a million people or more), 100k (the others of 100,000 or more) and 15k (the others of 15,000 or more).
loadCitiesfunctionThe cities of the tiers asked for, fetched with a dynamic import (a bundler makes a chunk of each tier) and joined into one set.
NearestOptionstypeWhat nearest and within may be asked.

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