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>
引数
| 名前 | 型 | 説明 |
|---|---|---|
code | string | A flag's code, in any case. |
date | string | Date | The day: a |
options (省略可) | Omit<FlagOptions, "variant" | "date"> | undefined |
|
戻り値
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")); // truenull
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出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。