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
| Name | Type | Description |
|---|---|---|
code | string | 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")); // 12
1What it prints (run when this page was built)