本文へ移動

Hata旗

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

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

目次

リファレンス · 必要なときの旗の読み込み

flagOn関数

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

The flag of a day with its drawing and the reason for a blank: flag(code, { date }) and flagOn(code, date) from /manifest in one call. Where another flag exists for the day (Canada in 1962: the Union Flag is legal and the Red Ensign was flown) variant.other says which and why; where there is no drawing (no flag known that day, or a restricted flag without allowRestricted) svg is null and none says why, in a sentence.

インポート

import { flagOn } from "@johnmorrisdotca/hata/load";

定義

function flagOn(code: string, date: string | Date, options?: Omit<FlagOptions, "variant" | "date">): Promise<LoadedFlagOn>

引数

名前型説明
codestring

A flag's code, in any case.

datestring | Date

The day: a Date, or "YYYY-MM-DD", "YYYY-MM" or "YYYY".

options (省略可)Omit<FlagOptions, "variant" | "date"> | undefined

role, allowRestricted and how to frame it (shape, fit, label).

戻り値

Promise<LoadedFlagOn>

A promise of the day's answer, never null.

例

import { flagOn } from "@johnmorrisdotca/hata/load";

const day = await flagOn("DE", "1940");
console.log(day.svg);           // null: restricted
console.log(day.none?.reason);  // "Flag of Nazi Germany, 1935–1945. Shown for history and education. …"
const shown = await flagOn("DE", "1940", { allowRestricted: true });
console.log(shown.svg?.startsWith("<svg")); // true
null
Flag of Nazi Germany, 1935–1945. Shown for history and education. Displaying it is restricted by law in Germany and Austria outside those purposes.
true

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

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

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