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)

SearchPlacesOptionstype

What searchPlaces may be asked.

Import it

import type { SearchPlacesOptions } from "@johnmorrisdotca/kuni/places";

Definition

interface SearchPlacesOptions {
    lang?: "en" | "ja";
    limit?: number;
    tiers?: readonly CityTier[];
    country?: string;
    match?: "anywhere" | "start";
}

Members

NameTypeDescription
lang (optional)"en" | "ja" | undefined

The language of each hit's label: "en" (the default) or "ja". The search itself is over every name.

limit (optional)number | undefined

The most hits to return; 20 by default, at most 100.

tiers (optional)readonly CityTier[] | undefined

The tiers of cities to search: the capitals, the cities of a million or more and of 100,000 or more by default. "15k" fetches every country's file.

country (optional)string | undefined

Search the cities of this country only (every tier, loaded on its own), and no countries.

match (optional)"anywhere" | "start" | undefined

"anywhere" (the default) finds the text anywhere in a name. "start" finds it only at the start of a name or of a word in it (Paris, New York for "york"), and so fetches only the part of the capitals and of the 100k tier that holds such names (a few kilobytes, not the whole tier): the right one for a box that searches as somebody types.

Examples

import type { SearchPlacesOptions } from "@johnmorrisdotca/kuni/places";

const value: SearchPlacesOptions = { lang: "ja", limit: 5 };
console.log(Object.keys(value).join(" "));
lang limit

What it prints (run when this page was built)

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