Skip to main content
Module

std/url/mod.ts>join

The Deno Standard Library
Latest
function join
import { join } from "https://deno.land/std@0.224.0/url/mod.ts";

Joins a base URL or URL string, and a sequence of path segments together, then normalizes the resulting URL.

Examples

Basic usage

import { join } from "https://deno.land/std@0.224.0/url/join.ts";

join("https://deno.land/", "std", "path", "mod.ts").href;
// "https://deno.land/std/path/mod.ts"

join("https://deno.land", "//std", "path/", "/mod.ts").href;
// "https://deno.land/path/mod.ts"

Parameters

url: string | URL

Base URL to be joined with the paths and normalized.

...paths: string[]

Array of path segments to be joined to the base URL.

Returns

A complete URL containing the base URL joined with the paths.