本文へ移動

Kuni国

国、コード、名前、行政区画を調べ、必要なときに国のデータを読み込み、標準の国のカードを表示できます。

「国(くに)」は、国を表す日本語です。 名前について(英語)

目次

リファレンス · 場所:大陸の国と検索(サイズはすべての段階を含みます)

SearchPlacesOptions型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

What searchPlaces may be asked.

インポート

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

定義

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

メンバー

名前型説明
lang (省略可)"en" | "ja" | undefined

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

limit (省略可)number | undefined

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

tiers (省略可)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 (省略可)string | undefined

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

match (省略可)"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.

例

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

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

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/kuni 1.19.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。