Reference · Flags by their colours
tagsOffunction
What is on a flag, as tags from the closed list, each with where it comes from. A tag that is unreviewed is a
guess: show it as one, or leave it out. A flag with no tag yet has an empty list, which does not say it is plain.
manifest(code).tags has the same tags with what each rests on.
Import it
import { tagsOf } from "@johnmorrisdotca/hata/search";
Definition
function tagsOf(code: string, options?: { variant?: string; }): readonly FlagTag[]
Parameters
| Name | Type | Description |
|---|---|---|
code | string | A flag's code in any case: "JP", "jp-13", "CA_ON"; a former country by its code or one of its aliases. |
options (optional) | { variant?: string; } | undefined |
|
Returns
readonly FlagTag[]
The tags, frozen, in the order of FLAG_TAGS; an empty list when the code has no flag here, no such variant, or no tag yet.
Examples
import { tagsOf } from "@johnmorrisdotca/hata/search";
console.log(tagsOf("DE")); // [{ tag: "plain", source: "computed" }, { tag: "stripes-horizontal", source: "computed" }]
console.log(tagsOf("DK")); // [{ tag: "cross", source: "wikidata" }, { tag: "nordic-cross", source: "wikidata" }]
console.log(tagsOf("XX")); // [][
{ tag: 'plain', source: 'computed' },
{ tag: 'stripes-horizontal', source: 'computed' }
]
[
{ tag: 'cross', source: 'wikidata' },
{ tag: 'nordic-cross', source: 'wikidata' }
]
[]What it prints (run when this page was built)