Function format
- format(pathObject): string
Parameters
- pathObject: Partial<ParsedPath>
Object with path components.
Returns string
The formatted path.
Example: Usage
import { format } from "@std/path/format";
import { assertEquals } from "@std/assert";
if (Deno.build.os === "windows") {
assertEquals(format({ dir: "C:\\path\\to", base: "script.ts" }), "C:\\path\\to\\script.ts");
} else {
assertEquals(format({ dir: "/path/to/dir", base: "script.ts" }), "/path/to/dir/script.ts");
}- pathObject: Partial<ParsedPath>
Generate a path from a
ParsedPathobject. It does the opposite ofparse().