Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback


The Deno Standard Library
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.// This module is browser compatible.
import { join as posixJoin } from "../path/posix/join.ts";
/** * Joins a base URL or URL string, and a sequence of path segments together, * then normalizes the resulting URL. * * @param url Base URL to be joined with the paths and normalized. * @param paths Array of path segments to be joined to the base URL. * @returns A complete URL containing the base URL joined with the paths. * * @example Basic usage * ```ts * import { join } from "$STD_VERSION/url/join.ts"; * * join("", "std", "path", "mod.ts").href; * // "" * * join("", "//std", "path/", "/mod.ts").href; * // "" * ``` */export function join(url: string | URL, ...paths: string[]): URL { url = new URL(url); url.pathname = posixJoin(url.pathname, ...paths); return url;}