Variant型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
One of a place's flags in real use, for flag(code, { variant }) and variantsOf(code): Afghanistan's Republic tricolour and
the Taliban's flag, Bavaria's lozenges and stripes, Guadeloupe's French tricolour and its local flag.
official: adopted by the authority that has the right to.de-facto: flown by whoever holds the territory, without that recognition.historical: no longer official, and still flown.local: in use there, and not made the place's own flag by its authority.
インポート
import type { Variant } from "@johnmorrisdotca/hata/manifest";
定義
interface Variant {
id: string;
name: string;
nameJa: string;
status: "official" | "de-facto" | "historical" | "local";
from: string | null;
until: string | null;
why: string;
source: string;
default: boolean;
module: string;
frames: Record<"4:3" | "1:1" | "round", "cover" | "crop" | "contain">;
drawing: {
source: FlagSource;
file: string;
page: string;
licence: {
kind: LicenceKind;
name: string;
url: string | null;
};
author: string | null;
credit: string | null;
attributionRequired: boolean;
restrictions: string[];
uploaded: string | null;
width: number;
height: number;
bytes: number;
};
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
id | string | Kebab case, unique within the place: "de-facto", "stripes", "local". |
name | string | A name for a menu, in English. |
nameJa | string | The same in Japanese. |
status | "official" | "de-facto" | "historical" | "local" | Its standing: see above. |
from | string | null | When it came into use, as precisely as is known ( |
until | string | null | When it went out of official use; null where it has not. |
why | string | Why it is offered, and (for the default) why it is the default, in a sentence or two. |
source | string | Where the claim above is documented: a web page. |
default | boolean | True for the one |
module | string | The module that has its SVG: |
frames | Record<"4:3" | "1:1" | "round", "crop" | "cover" | "contain"> | What |
drawing | { source: FlagSource; file: string; page: string; licence: { kind: LicenceKind; name: string; url: string | null; }; author: string | null; credit: string | null; attributionRequired: boolean; restrictions: string[]; uploaded: string | null; width: number; height: number; bytes: number; } | Where this drawing comes from: its Commons file, page, licence, author and size, as for a flag's record. |
例
import { variantsOf, type Variant } from "@johnmorrisdotca/hata/manifest";
const taliban: Variant | undefined = variantsOf("AF").find((one) => one.status === "de-facto");
console.log(taliban?.id); // "de-facto"
console.log(taliban?.from); // "2021-08-15"
console.log(taliban?.module); // "af--de-facto": import it from "@johnmorrisdotca/hata/flags/af--de-facto"de-facto
2021-08-15
af--de-facto出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。