Skip to content

pennants/fetch ​

Fetch mode: load flags over HTTP instead of bundling a loader map. import { fetchPennant } from 'pennants/fetch'.

Functions ​

fetchPennant() ​

ts
function fetchPennant(code, options?): Promise<string>;

Fetches the SVG markup of one flag from static assets (<base>/svg/<shape>/<code>.svg) instead of bundling it. Same contract as the root fetchPennant: cached and de-duplicated per URL, parsed with DOMParser and accepted only as a single allowlisted <svg> document (re-serialised), browser-only (rejects without DOMParser), RangeError for unknown codes or shapes.

Parameters ​

ParameterType
codestring
options?FetchPennantOptions

Returns ​

Promise<string>

References ​

DEFAULT_CDN_BASE ​

Re-exports DEFAULT_CDN_BASE


FetchPennantOptions ​

Re-exports FetchPennantOptions


pennantUrl ​

Re-exports pennantUrl

MIT licensed. Flag artwork from flag-icons (MIT).