本文へ移動

Hata旗

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

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

目次

リファレンス · 色で旗を探す

tagsOf関数

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

What is on a flag, as tags from the closed list, each with where it comes from. A tag that is unreviewed is a guess: show it as one, or leave it out. A flag with no tag yet has an empty list, which does not say it is plain. manifest(code).tags has the same tags with what each rests on.

インポート

import { tagsOf } from "@johnmorrisdotca/hata/search";

定義

function tagsOf(code: string, options?: { variant?: string; }): readonly FlagTag[]

引数

名前型説明
codestring

A flag's code in any case: "JP", "jp-13", "CA_ON"; a former country by its code or one of its aliases.

options (省略可){ variant?: string; } | undefined

variant: the id of another of the place's flags (variantsOf(code)), such as Afghanistan's "de-facto".

戻り値

readonly FlagTag[]

The tags, frozen, in the order of FLAG_TAGS; an empty list when the code has no flag here, no such variant, or no tag yet.

例

import { tagsOf } from "@johnmorrisdotca/hata/search";

console.log(tagsOf("DE")); // [{ tag: "plain", source: "computed" }, { tag: "stripes-horizontal", source: "computed" }]
console.log(tagsOf("DK")); // [{ tag: "cross", source: "wikidata" }, { tag: "nordic-cross", source: "wikidata" }]
console.log(tagsOf("XX")); // []
[
  { tag: 'plain', source: 'computed' },
  { tag: 'stripes-horizontal', source: 'computed' }
]
[
  { tag: 'cross', source: 'wikidata' },
  { tag: 'nordic-cross', source: 'wikidata' }
]
[]

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

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

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