import { endsWith } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/path.js";
Checks if the path
ends with the given sub
path.
This function doesn't check the path string directly, instead, it checks the path segments.
This function is ignorant about the path separator, the query string and the hash string (if present). And is case-insensitive on Windows volume symbol by default.
Examples
Example 1
Example 1
import { endsWith } from "@ayonli/jsext/path";
console.assert(endsWith("/usr/bin", "bin"));
console.assert(endsWith("C:\\Windows\\System32", "System32"));
console.assert(endsWith("http://example.com/foo/bar", "bar"));
console.assert(endsWith("file:///C:/Windows/System32", "System32"));
// To be noted, an absolute sub path has its own root.
console.assert(!endsWith("/usr/bin", "/bin"));