import { dirname } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/path/index.js";
Returns the parent path of the given path
.
Examples
Example 1
Example 1
import { dirname } from "@ayonli/jsext/path";
console.log(dirname("foo/bar")); // "foo"
console.log(dirname("/foo/bar")); // "/foo"
console.log(dirname("C:\\foo\\bar")); // "C:\\foo"
console.log(dirname("file:///foo/bar")); // "file:///foo"
console.log(dirname("http://example.com/foo/bar")); // "http://example.com/foo"
console.log(dirname("http://example.com/foo")); // "http://example.com"
console.log(dirname("http://example.com/foo/bar?foo=bar#baz")); // "http://example.com/foo"