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

FlagUrlOptionstype

Where flagUrl finds the SVG files: a folder holding <code>.svg.

Import it

import type { FlagUrlOptions } from "@johnmorrisdotca/hata";

Definition

interface FlagUrlOptions {
    base?: string;
}

Members

NameTypeDescription
base (optional)string | undefined

The folder's address, with or without a trailing slash. Left out, it is this major version on the jsDelivr CDN, https://cdn.jsdelivr.net/npm/@johnmorrisdotca/hata@1/dist/svg. A page that copies node_modules/@johnmorrisdotca/hata/dist/svg into its own files names that folder, such as "/flags".

Examples

import { flagUrl, type FlagUrlOptions } from "@johnmorrisdotca/hata";

const own: FlagUrlOptions = { base: "/static/flags" };
console.log(flagUrl("JP", own)); // "/static/flags/jp.svg"
/static/flags/jp.svg

What it prints (run when this page was built)

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