本文へ移動

Kuni国

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

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

目次

リファレンス · 国と検索の道具

countries関数

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

Every country: the 249 ISO 3166-1 codes and Kosovo (XK). order: "en" sorts by the English name folded (accents and case set aside); order: "ja" by the Japanese name in kana, its reading where it is written in kanji, in plain kana order (not a full Japanese collation).

インポート

import { countries } from "@johnmorrisdotca/kuni";

定義

function countries(options?: CountriesOptions): readonly Country[]

引数

名前型説明
options (省略可)CountriesOptions

order: "code" (the default), "en" or "ja".

戻り値

readonly Country[]

The 250 countries, the list and its objects frozen and shared.

例

import { countries } from "@johnmorrisdotca/kuni";

console.log(countries().length);                          // 250
console.log(countries({ order: "en" })[0].name.en);       // "Afghanistan"
console.log(countries({ order: "ja" })[0].name.ja);       // "アイスランド"
250
Afghanistan
アイスランド

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

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

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