summaryrefslogtreecommitdiff
path: root/std/path/posix.ts
diff options
context:
space:
mode:
authorFukuda Naoto <naoto.fukuda1217@gmail.com>2020-11-06 11:33:59 +0900
committerGitHub <noreply@github.com>2020-11-06 13:33:59 +1100
commitfd9b6e03af5ce8c8b78c2a0e71faa55a68890004 (patch)
tree782d9646364550dbbf543e29d03eeef91fd7555d /std/path/posix.ts
parentbfa00bef220fd26bed26940cdcaf5edf4bf83e13 (diff)
docs(std): add some missing JSDoc (#7765)
Refs #7487
Diffstat (limited to 'std/path/posix.ts')
-rw-r--r--std/path/posix.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/std/path/posix.ts b/std/path/posix.ts
index 7682ec788..e5cbbd6c1 100644
--- a/std/path/posix.ts
+++ b/std/path/posix.ts
@@ -16,6 +16,7 @@ export const sep = "/";
export const delimiter = ":";
// path.resolve([from ...], to)
+/** resolves `pathSegments` into an absolute path. */
export function resolve(...pathSegments: string[]): string {
let resolvedPath = "";
let resolvedAbsolute = false;
@@ -60,6 +61,7 @@ export function resolve(...pathSegments: string[]): string {
else return ".";
}
+/** Notmalize the `path`, resolving `'..'` and `'.'` segments. */
export function normalize(path: string): string {
assertPath(path);
@@ -84,6 +86,7 @@ export function isAbsolute(path: string): boolean {
return path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH;
}
+/** Join all given a sequence of `paths`,then normalizes the resulting path. */
export function join(...paths: string[]): string {
if (paths.length === 0) return ".";
let joined: string | undefined;
@@ -99,6 +102,7 @@ export function join(...paths: string[]): string {
return normalize(joined);
}
+/** Return the relative path from `from` to `to` based on current working directory. */
export function relative(from: string, to: string): string {
assertPath(from);
assertPath(to);
@@ -186,6 +190,7 @@ export function toNamespacedPath(path: string): string {
return path;
}
+/** Return the directory name of a `path`. */
export function dirname(path: string): string {
assertPath(path);
if (path.length === 0) return ".";
@@ -209,6 +214,7 @@ export function dirname(path: string): string {
return path.slice(0, end);
}
+/** Return the last portion of a `path`. Trailing directory separators are ignored. */
export function basename(path: string, ext = ""): string {
if (ext !== undefined && typeof ext !== "string") {
throw new TypeError('"ext" argument must be a string');
@@ -283,6 +289,7 @@ export function basename(path: string, ext = ""): string {
}
}
+/** Return the extention of the `path`. */
export function extname(path: string): string {
assertPath(path);
let startDot = -1;
@@ -333,6 +340,7 @@ export function extname(path: string): string {
return path.slice(startDot, end);
}
+/** Generate a path from `FormatInputPathObject` object. */
export function format(pathObject: FormatInputPathObject): string {
if (pathObject === null || typeof pathObject !== "object") {
throw new TypeError(
@@ -342,6 +350,7 @@ export function format(pathObject: FormatInputPathObject): string {
return _format("/", pathObject);
}
+/** Return a `ParsedPath` object of the `path`. */
export function parse(path: string): ParsedPath {
assertPath(path);