UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

13 lines (12 loc) 825 B
import type { AnyCaller } from "./function.js"; import { type Optional } from "./optional.js"; /** Values that can be converted to a URL instance. */ export type PossibleURL = string | URL; /** Is an unknown value a URL object? */ export declare function isURL(value: unknown): value is URL; /** Assert that an unknown value is a URL object. */ export declare function assertURL(value: unknown, caller?: AnyCaller): asserts value is URL; /** Convert a possible URL to a URL, or return `undefined` if conversion fails. */ export declare function getURL(possible: Optional<PossibleURL>, base?: PossibleURL | undefined): URL | undefined; /** Convert a possible URL to a URL, or throw `RequiredError` if conversion fails. */ export declare function requireURL(possible: PossibleURL, base?: PossibleURL, caller?: AnyCaller): URL;