@oazmi/build-tools
Version:
general deno build tool scripts which I practically use in all of my typescript repos
29 lines (28 loc) • 765 B
JavaScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.
import { _format, assertArg } from "../_common/format.js";
/**
* Generate a path from `FormatInputPathObject` object.
*
* @example Usage
* ```ts
* import { format } from "@std/path/windows/format";
* import { assertEquals } from "@std/assert/assert-equals";
*
* const path = format({
* root: "C:\\",
* dir: "C:\\path\\dir",
* base: "file.txt",
* ext: ".txt",
* name: "file"
* });
* assertEquals(path, "C:\\path\\dir\\file.txt");
* ```
*
* @param pathObject The path object to format.
* @returns The formatted path.
*/
export function format(pathObject) {
assertArg(pathObject);
return _format("\\", pathObject);
}