本文へ移動

Kuni国

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

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

目次

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

Country型

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

A country, or a territory with an ISO 3166-1 code of its own, as the lookups hand it out (frozen).

インポート

import type { Country } from "@johnmorrisdotca/kuni";

定義

interface Country {
    alpha2: string;
    alpha3: string;
    numeric: string;
    kind: "iso" | "user";
    name: {
        en: string;
        ja: string;
        local?: string;
    };
    shortName?: {
        en?: string;
        ja?: string;
    };
    reading?: string;
    flag: string;
    continent: Continent;
    subregion?: string;
    callingCode?: string;
    currency?: string[];
    tld?: string;
    capital?: {
        en: string;
        ja: string;
    };
    zones?: string[];
    languages?: string[];
    subdivisionType?: SubdivisionType;
    aliases?: string[];
    ioc?: string;
}

メンバー

名前型説明
alpha2string

ISO 3166-1 alpha-2, "JP"

alpha3string

ISO 3166-1 alpha-3, "JPN"

numericstring

ISO 3166-1 numeric, three digits, "392"

kind"iso" | "user"

"user" for a user-assigned code in common use: Kosovo, XK

name{ en: string; ja: string; local?: string; }

CLDR's names; local is the country's own name, where it differs

shortName (省略可){ en?: string; ja?: string; } | undefined

CLDR's short form: "US" and アメリカ for the United States

reading (省略可)string | undefined

The Japanese name in hiragana, only where the name is written in kanji

flagstring

The flag emoji: the two regional-indicator letters of alpha2

continent"AF" | "AS" | "NA" | "SA" | "AN" | "EU" | "OC"

The continent it is in, in the seven-continent model: "AS".

subregion (省略可)string | undefined

The UN M49 subregion, three digits: "030" is Eastern Asia

callingCode (省略可)string | undefined

The ITU country calling code, "+81"; "+1" for every member of the North American plan

currency (省略可)string[] | undefined

ISO 4217 codes of the currencies in use now, from CLDR: ["JPY"]

tld (省略可)string | undefined

The country-code top-level domain without its dot: "jp", and "uk" for GB

capital (省略可){ en: string; ja: string; } | undefined

The capital's name: English from countries-list, Japanese from Wikidata

zones (省略可)string[] | undefined

IANA time zones, from zone.tab, in its order: ["Asia/Tokyo"]

languages (省略可)string[] | undefined

ISO 639-1 codes of the languages spoken, most used first

subdivisionType (省略可)"atoll" | "autonomous-community" | "autonomous-region" | "borough" | "canton" | "capital-district" | "circuit" | "city" | "council-area" | "country" | "county" | "department" | "district" | "division" | "emirate" | "governorate" | "island" | "krai" | "metropolis" | "municipality" | "oblast" | "parish" | "prefecture" | "principal-area" | "province" | "quarter" | "region" | "republic" | "special-administrative-region" | "state" | "territory" | "unitary-authority" | "urban-prefecture" | "voivodeship" | "zone" | undefined

The kind most of its first-level subdivisions are

aliases (省略可)string[] | undefined

Other names people use for it, in either language: "Holland", "UK", 米国

ioc (省略可)string | undefined

The International Olympic Committee's country code, three letters and not always the alpha-3: "JPN", "GER" for Germany (DEU), "SUI" for Switzerland (CHE). From Wikidata (P984). Absent for the countries with no National Olympic Committee.

例

import type { Country } from "@johnmorrisdotca/kuni";
import { country } from "@johnmorrisdotca/kuni";

const value: Country = country("JP")!;
console.log(typeof value === "object" ? Object.keys(value).slice(0,6) : value);
[ 'alpha2', 'alpha3', 'numeric', 'kind', 'name', 'flag' ]

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

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

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