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 · Country and region names

flagAspectfunction

A flag's width over its height, from its picture's viewBox, without loading the picture: 1.5 for Japan's 2:3, 2 for Canada's 1:2. For keeping a flag's box before its picture arrives.

Import it

import { flagAspect } from "@johnmorrisdotca/hata/names";

Definition

function flagAspect(code: string): number | null

Parameters

NameTypeDescription
codestring

A flag's code, in any case.

Returns

number | null

The aspect ratio, or null when the code has no flag here.

Examples

import { flagAspect } from "@johnmorrisdotca/hata/names";

console.log(flagAspect("CA"));    // 2
console.log(flagAspect("CH"));    // 1
2
1

What it prints (run when this page was built)

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