Module

std/url/mod.ts>normalize

The Deno Standard Library
Go to Latest
function normalize
import { normalize } from "https://dotland.deno.dev/std@0.223.0/url/mod.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.223.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

URL

normalized URL