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

std/url/normalize.ts>normalize

Deno standard library
Go to Latest
function normalize
import { normalize } from "https://deno.land/std@0.208.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.208.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