本文へ移動

Hata旗

国や地域の旗を読み込み、対応する表示の形を選び、絵ごとの資料・作者・ライセンスを保てます。

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

目次

リファレンス · 国と地域の名前

flagCode関数

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

The code of a flag, from any of the names a table uses for the place. Besides what the main entry's flagCode reads (an alpha-2 or a subdivision code, in any case, and a former country's alias), this one also reads an alpha-3 (JPN), a numeric code (392), an IOC code (GER, SUI), the place's name in English or Japanese (Holland, UK, 日本, and katakana as hiragana), and a flag emoji. A code or a name that two places hold (CS, England, Georgia) is null, because a near miss would draw the wrong flag. FIFA codes are not here: Kuni does not list them.

インポート

import { flagCode } from "@johnmorrisdotca/hata/names";

定義

function flagCode(input: string): string | null

引数

名前型説明
inputstring

A code, a name, or a flag emoji.

戻り値

string | null

The code as this package writes it ("JP", "JP-13", "SUHH"), or null when nothing here has that flag.

例

import { flagCode, flagEmoji } from "@johnmorrisdotca/hata/names";

console.log(flagCode("JPN"), flagCode("392"), flagCode("GER")); // "JP", "JP", "DE"
console.log(flagCode("Holland"), flagCode("UK"), flagCode("日本")); // "NL", "GB", "JP"
console.log(flagCode("🇯🇵")); // "JP"
console.log(flagCode("CS"), flagCode("England")); // null, null
console.log(flagEmoji("GB-ENG")); // the England tag sequence
JP JP DE
NL GB JP
JP
null null
🏴󠁧󠁢󠁥󠁮󠁧󠁿

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

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

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