Skip to the content

Hata旗

Load a native country or region flag, choose supported framing and keep each drawing’s source, author and licence.

Hata (旗) is Japanese for a flag. About the name

Contents

Reference · Ship signal flags (International Code of Signals)

signalIdfunction

The id of a flag from an id written loosely: either case, with spaces around it, with or without ics:.

Import it

import { signalId } from "@johnmorrisdotca/hata/signals";

Definition

function signalId(input: string): SignalId | null

Parameters

NameTypeDescription
inputstring

"A", " a ", "ics:A", "7", "answer".

Returns

"ics:a" | "ics:b" | "ics:c" | "ics:d" | "ics:e" | "ics:f" | "ics:g" | "ics:h" | "ics:i" | "ics:j" | "ics:k" | "ics:l" | "ics:m" | "ics:n" | "ics:o" | "ics:p" | "ics:q" | "ics:r" | "ics:s" | "ics:t" | "ics:u" | "ics:v" | "ics:w" | "ics:x" | "ics:y" | "ics:z" | "ics:0" | "ics:1" | "ics:2" | "ics:3" | "ics:4" | "ics:5" | "ics:6" | "ics:7" | "ics:8" | "ics:9" | "ics:sub-1" | "ics:sub-2" | "ics:sub-3" | "ics:answer" | "usn:code-answer" | "usn:corpen" | "usn:designation" | "usn:emergency" | "usn:formation" | "usn:interrogative" | "usn:negative" | "usn:preparative" | "usn:screen" | "usn:speed" | "usn:starboard" | "usn:station" | "usn:subdivision" | "usn:substitute-1" | "usn:substitute-2" | "usn:substitute-3" | "usn:substitute-4" | "usn:turn" | null

The id as this package writes it ("ics:a"), or null when the Code has no such flag.

Examples

import { signalId } from "@johnmorrisdotca/hata/signals";

console.log(signalId(" A "));    // "ics:a"
console.log(signalId("ics:7"));  // "ics:7"
console.log(signalId("ics:xx")); // null
ics:a
ics:7
null

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hata 1.31.0.