Reference · Flags by their colours
flagsWithfunction
The flags that have every colour and every tag asked for. A flag has a colour when the colours of that name cover
at least 1% of it. With only, the flags with those colours and no other: no other name covers more than 3% of
the flag, so a small emblem does not keep Mexico out of "green, white and red". A flag has a tag when one of the
sources gives it: every source when left out, or only the ones named, to leave the guesses out.
Import it
import { flagsWith } from "@johnmorrisdotca/hata/search";
Definition
function flagsWith(query: { colours?: readonly ColourName[]; only?: boolean; tags?: readonly TagName[]; sources?: readonly TagSource[]; }): string[]
Parameters
| Name | Type | Description |
|---|---|---|
query | { colours?: readonly ColourName[]; only?: boolean; tags?: readonly TagName[]; sources?: readonly TagSource[]; } |
|
Returns
string[]
The codes, in the order of FLAG_CODES; a place's default flag is the one looked at.
Examples
import { flagsWith } from "@johnmorrisdotca/hata/search";
console.log(flagsWith({ colours: ["red", "white"], only: true }).includes("JP")); // true
console.log(flagsWith({ colours: ["green", "white", "orange"], only: true })); // Ireland, Côte d'Ivoire, India, Niger …
console.log(flagsWith({ tags: ["nordic-cross"] })); // Denmark, Finland, Iceland, Norway, Sweden …
console.log(flagsWith({ tags: ["stripes-horizontal"], sources: ["reviewed", "computed"], colours: ["yellow"] })); // Germany, Ukraine …true
[ 'CI', 'CY', 'IE', 'IN', 'NE' ]
[
'AX', 'BV', 'DK',
'FI', 'FO', 'IS',
'NO', 'SE', 'SJ',
'NQAQ'
]
[
'AM', 'BO', 'CO',
'DE', 'GA', 'LT',
'MU', 'UA', 'AT-1',
'AT-2', 'AT-3', 'DE-BW',
'DE-MV', 'FRG', 'XSV'
]What it prints (run when this page was built)