import { equals } from "https://deno.land/x/ayonli_jsext@v0.9.72/path.ts";
Checks if the path1
and path2
describe the same 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 { equals } from "@ayonli/jsext/path";
console.assert(equals("/usr/bin", "/usr/bin"));
console.assert(equals("C:\\Windows\\System32", "c:/Windows/System32"));
console.assert(equals("http://example.com/foo/bar?foo=bar", "http://example.com/foo/bar"));
console.assert(equals("file://localhost/C:/Windows/System32", "file:///c:/Windows/System32"));
// ignore file protocol
console.assert(equals("file:///C:/Windows/System32", "C:\\Windows\\System32", {
ignoreFileProtocol: true,
}));