本文へ移動

Kuni国

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

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

目次

リファレンス · /capitals

capitalsOf関数

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

The capitals of a country that has more than one capital city, or a capital that capital does not name alone, each with its role: South Africa's Pretoria (administrative), Cape Town (legislative) and Bloemfontein (judicial). Each role is what the country's own government or law says, read on the day in CAPITALS_READ; docs/capitals.md lists the page and the line for every one. The country's capital is unchanged.

インポート

import { capitalsOf } from "@johnmorrisdotca/kuni/capitals";

定義

function capitalsOf(code: string): readonly CountryCapital[] | null

引数

名前型説明
codestring

An ISO 3166-1 alpha-2 code, "ZA" or "za".

戻り値

readonly CountryCapital[] | null

The capitals in the order of the table, frozen; null for a country with no entry (almost every country, whose one capital is capital) and for anything that is not a code. Israel and the Palestinian Territories have no entry: a disputed capital is left to the maintainer.

例

import { capitalsOf } from "@johnmorrisdotca/kuni/capitals";

console.log(capitalsOf("ZA")?.map((one) => `${one.name.en} ${one.role}`)); // ["Pretoria administrative", "Cape Town legislative", "Bloemfontein judicial"]
console.log(capitalsOf("BI")?.map((one) => `${one.name.ja} ${one.role}`));  // ["ギテガ political", "ブジュンブラ economic"]
console.log(capitalsOf("JP"));                                             // null
[
  'Pretoria administrative',
  'Cape Town legislative',
  'Bloemfontein judicial'
]
[ 'ギテガ political', 'ブジュンブラ economic' ]
null

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

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

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