本文へ移動

Kuni国

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

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

目次

リファレンス

国と検索の道具

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

最小化と gzip 圧縮をしたサイズは 21.4 kB(読み込むものをすべて含み、esbuild で計測)

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

エクスポート

名前種類概要
Continent型A continent's two letters: "AF", "AN", "AS", "EU", "NA", "OC" or "SA".
continentName関数A continent's name, from CLDR.
CONTINENTS定数The seven continents, as two letters: Africa, Antarctica, Asia, Europe, North America, Oceania, South America.
countries関数Every country: the 249 ISO 3166-1 codes and Kosovo (XK).
CountriesOptions型What countries() may be asked.
country関数One country by its code.
Country型A country, or a territory with an ISO 3166-1 code of its own, as the lookups hand it out (frozen).
COUNTRY_CODES定数The 250 country codes: the 249 ISO 3166-1 alpha-2 codes and XK for Kosovo, in alphabetical order.
countryByName関数A country from what somebody typed: its name or short name in English or Japanese ("Germany", ドイツ, どいつ), its own name ("Deutschland"), a name it is also known by ("Holland", "UK", 米国), or a code.
CountryCode型One of the 250 country codes, as a type: "JP" | "US" | ...
countryName関数A country's name in English or Japanese.
CountryNameOptions型What countryName() may be asked.
CountryOrder型The order countries() lists them in: "code" (alpha-2), "en" (by English name) or "ja" (by Japanese name, in kana).
flag関数The flag of a country as an emoji: two regional-indicator letters, which most systems draw as the flag and some (Windows) as the two letters.
fold関数What two ways of typing a name have in common: width (full-width letters to ASCII, half-width katakana to full), case, accents (except the two marks that make が and ぱ), katakana to hiragana, apostrophes dropped, and every other run of punctuation or space to one space.
isCountryCode関数Whether a value is one of the 250 codes exactly as ISO writes it: two capital letters ("JP", and "XK" for Kosovo).
Language型A language every name is kept in: "en" or "ja".
LANGUAGES定数The two languages every name is kept in.
Subdivision型A subdivision of a country (a state, a province, a prefecture), with its ISO 3166-2 code, as the lookups hand it out (frozen).
SubdivisionType型A kind of subdivision, in kebab case: "prefecture", "state", "autonomous-community".
subregionName関数A UN M49 subregion's name, from CLDR.
VERSION定数The package's version, the same as package.json's.

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

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