keep-a-changelog
Version:
Node package to parse and generate changelogs following the [keepachangelog](https://keepachangelog.com/) format.
29 lines (28 loc) • 725 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 `ParsedPath` object.
*
* @example Usage
* ```ts
* import { format } from "@std/path/posix/format";
* import { assertEquals } from "@std/assert";
*
* const path = format({
* root: "/",
* dir: "/path/dir",
* base: "file.txt",
* ext: ".txt",
* name: "file"
* });
* assertEquals(path, "/path/dir/file.txt");
* ```
*
* @param pathObject The path object to format.
* @returns The formatted path.
*/
export function format(pathObject) {
assertArg(pathObject);
return _format("/", pathObject);
}