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

x/ayonli_jsext/path.ts>sanitize

A JavaScript extension package for building strong and modern applications.
Latest
function sanitize
import { sanitize } from "https://deno.land/x/ayonli_jsext@v0.9.72/path.ts";

Similar to normalize, but also remove the search string and hash string if present.

Examples

Example 1

import { sanitize } from "@ayonli/jsext/path";

console.log(sanitize("foo/bar?query")); // "foo/bar"
console.log(sanitize("foo/bar#hash")); // "foo/bar"
console.log(sanitize("foo/bar/..?query#hash")); // "foo"
console.log(sanitize("foo/./bar/..?query#hash")); // "foo"

Parameters

path: string

Returns

string