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[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
code | string | 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' ]
[]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。