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

x/ayonli_jsext/esm/path/index.js>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/esm/path/index.js";

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"