Reference · Flag source and framing metadata
variantsOffunction
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 it
import { variantsOf } from "@johnmorrisdotca/hata/manifest";
Definition
function variantsOf(code: string): readonly Variant[]
Parameters
| Name | Type | Description |
|---|---|---|
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. |
Returns
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.
Examples
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' ]
[]What it prints (run when this page was built)