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 · Codes, URLs and SVG helpers

isFlagCodefunction

True for one of the codes with a flag, written exactly as Kuni writes it: "JP", "JP-13", "CA-ON", "US-TX". Lower case is not a code here; flagCode is the forgiving one.

Import it

import { isFlagCode } from "@johnmorrisdotca/hata";

Definition

function isFlagCode(value: unknown): value is FlagCode

Parameters

NameTypeDescription
valueunknown

Anything.

Returns

boolean

true when value is a string in FLAG_CODES, and false for anything else, never throwing.

Examples

import { isFlagCode } from "@johnmorrisdotca/hata";

console.log(isFlagCode("JP-13")); // true
console.log(isFlagCode("jp-13")); // false: see flagCode
console.log(isFlagCode("EH"));    // false: no flag in this version (see /manifest's leftOut)
true
false
false

What it prints (run when this page was built)

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