Skip to main content

@std/url@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
function normalize
normalize(url: string | URL): URL

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

Examples

Example 1

import { normalize } from "@std/url/normalize";

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

to be normalized

Return Type

normalized URL

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/url

Import symbol

import { normalize } from "@std/url";
or

Import directly with a jsr specifier

import { normalize } from "jsr:@std/url";