resolveDocumentUrl
resolveDocumentUrl<
T>(url,base):T
Defined in: packages/core/src/utils/document-base.ts:91
Resolve one URL from a map document against the document base.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
url | T | The URL or path as the author wrote it. |
base | string | null | undefined | The base (any form normalizeDocumentBase accepts). |
Returns
Section titled “Returns”T
The URL to fetch. Unchanged without a base, for absolute and
protocol-relative URLs, for #/?-only references, for non-strings, and
for a root-relative path that already starts with the base.
Example
Section titled “Example”resolveDocumentUrl("/data/x.geojson", "/my-repo/"); // "/my-repo/data/x.geojson"resolveDocumentUrl("data/x.geojson", "/my-repo"); // "/my-repo/data/x.geojson"resolveDocumentUrl("/my-repo/data/x.geojson", "/my-repo/"); // unchangedresolveDocumentUrl("https://example.com/x.geojson", "/my-repo/"); // unchangedresolveDocumentUrl("data/x.geojson", null); // unchanged