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
| Name | Kind | What it is |
|---|---|---|
citiesOf | function | One country's cities, every tier together, the most populous first: the same list as |
City | type | One city, as every tier hands it out (frozen): plain numbers and codes, null where no source has the fact. |
CITY_TIERS | constant | The names of the four tiers, in the order of their size. |
CityAt | type | A city and how far it is from the point asked about. |
cityById | function | One 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. |
citySet | function | Joins lists of cities (a tier's list, or several) into one set with the lookups built once. |
CitySet | type | Cities joined for lookups: by id, by country, by subdivision and by nearness. |
CitySource | type | Which input a fact in a city's record came from. |
CityTier | type | The 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). |
loadCities | function | The cities of the tiers asked for, fetched with a dynamic import (a bundler makes a chunk of each tier) and joined into one set. |
NearestOptions | type | What nearest and within may be asked. |