本文へ移動

Hata旗

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

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

目次

リファレンス · 旗の資料と表示の情報

variantsOf関数

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

Every flag of a place that has more than one in real use, with its status, dates, reason and drawing: Afghanistan's Republic tricolour (the default) and the Taliban's flag, Bavaria's lozenges and stripes, Northern Ireland's Union Flag and former Ulster Banner (it has no flag of its own by default), the French tricolour and the local flag of each French territory. The package takes no side between them: each has a status, and the default's reason is in its why. Load one with flag(code, { variant: id }) from /load, or import its module.

インポート

import { variantsOf } from "@johnmorrisdotca/hata/manifest";

定義

function variantsOf(code: string): readonly Variant[]

引数

名前型説明
codestring

A code in any case: "AF", "de-by", "GB_NIR". A code that is the same place as another (Guadeloupe's "FR-971" and "GP") gives the same list.

戻り値

readonly Variant[]

The place's variants, the default's first where there is one; an empty list where the place has one flag, or the code is not one Kuni knows here.

例

import { variantsOf } from "@johnmorrisdotca/hata/manifest";

console.log(variantsOf("AF").map((one) => `${one.id}: ${one.status}`)); // ["republic: official", "de-facto: de-facto"]
console.log(variantsOf("GB-NIR").map((one) => one.id));                  // ["union-flag", "ulster-banner"]
console.log(variantsOf("JP"));                                           // []: Japan has one flag
[ 'republic: official', 'de-facto: de-facto' ]
[ 'union-flag', 'ulster-banner' ]
[]

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

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

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