本文へ移動

Hata旗

国や地域の旗を読み込み、対応する表示の形を選び、絵ごとの資料・作者・ライセンスを保てます。

「旗(はた)」は、旗を表す日本語です。 名前について(英語)

目次

リファレンス · 色で旗を探す

flagsWith関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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 { flagsWith } from "@johnmorrisdotca/hata/search";

定義

function flagsWith(query: { colours?: readonly ColourName[]; only?: boolean; tags?: readonly TagName[]; sources?: readonly TagSource[]; }): string[]

引数

名前型説明
query{ colours?: readonly ColourName[]; only?: boolean; tags?: readonly TagName[]; sources?: readonly TagSource[]; }

colours: the names to look for, of COLOUR_NAMES. only: true to leave out a flag with another colour. tags: the tags to look for, of FLAG_TAGS. sources: the tag sources that count, of TAG_SOURCES. With no colours and no tags, every flag is found (with only, none).

戻り値

string[]

The codes, in the order of FLAG_CODES; a place's default flag is the one looked at.

例

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'
]

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/hata 1.31.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。