Skip to main content

fillUrlTemplate

Fills a URL template from string values, encoding each one. The placeholders named in leftAlone are left for the map engine, which are its own ({z}, {x}, {y}, {bbox-epsg-3857}) unless a caller says otherwise. A request the engine does not make, such as an identify URL, passes none, so it can fill {x} and {y} itself.

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { fillUrlTemplate } from "@mapcairn/core";

function fillUrlTemplate(template: string, values: Readonly<Record<string, string>>, leftAlone?: readonly string[]): string;

Parameters​

  • template (string)
  • values (Readonly<Record<string, string>>)
  • leftAlone? (readonly string[])

Returns​

string

Throws​

  • When a variable has no value: a definition that passed validation never does this, so it is a programming error, not a runtime condition.

Source: packages/core/src/layers/template.ts:130