Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/url/normalize.ts>normalize

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function normalize
import { normalize } from "https://deno.land/std@0.202.0/url/normalize.ts";

Normalize the URL, resolving '..' and '.' segments and multiple '/'s into '//' after protocol and remaining into '/'.

Examples

Example 1

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

console.log(normalize("https:///deno.land///std//assert//.//mod.ts").href);
// Outputs: "https://deno.land/std/path/mod.ts"

console.log(normalize("https://deno.land/std/assert/../async/retry.ts").href);
// Outputs: "https://deno.land/std/async/retry.ts"

Parameters

url: string | URL

to be normalized

Returns

normalized URL