mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
8b90e3154c
* docs: add detailed info on the ParsedPath interface * docs: add detailed info on the ParsedPath interface * docs: add examples of path/basename.ts * fmt * fix * fix type error * formatting nits --------- Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com> Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
18 lines
615 B
TypeScript
18 lines
615 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
// This module is browser compatible.
|
|
|
|
import { isWindows } from "./_os.ts";
|
|
import { format as posixFormat } from "./posix/format.ts";
|
|
import { format as windowsFormat } from "./windows/format.ts";
|
|
import type { FormatInputPathObject } from "./_interface.ts";
|
|
|
|
/**
|
|
* Generate a path from `FormatInputPathObject` object. It does the opposite
|
|
* of `parse`.
|
|
*
|
|
* @param pathObject with path
|
|
*/
|
|
export function format(pathObject: FormatInputPathObject): string {
|
|
return isWindows ? windowsFormat(pathObject) : posixFormat(pathObject);
|
|
}
|