@dash0/sdk-web
Version:
Dash0's Web SDK to collect telemetry from end-users' web browsers
12 lines (11 loc) • 336 B
JavaScript
import { doc, loc } from "./globals";
/**
* Parses url using URL constructor. Supports URL objects as passthrough input to simplify implementations
* May throw if parsing fails
* @param url
*/
export function parseUrl(url) {
if (typeof url !== "string")
return url;
return new URL(url, doc?.baseURI ?? loc?.href);
}