From 860f9f88f69288b702b4a6bbbcec31f4eae74028 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 1 May 2018 19:02:35 -0700 Subject: [PATCH] Update documentation comments --- src/compiler/core.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 382bb1a6d30..ccb80886d98 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -2134,7 +2134,7 @@ namespace ts { * Returns the path except for its basename. Semantics align with NodeJS's `path.dirname` * except that we support URL's as well. * - * ```js + * ```ts * getDirectoryPath("/path/to/file.ext") === "/path/to" * getDirectoryPath("/path/to/") === "/path" * getDirectoryPath("/") === "/" @@ -2145,7 +2145,7 @@ namespace ts { * Returns the path except for its basename. Semantics align with NodeJS's `path.dirname` * except that we support URL's as well. * - * ```js + * ```ts * getDirectoryPath("/path/to/file.ext") === "/path/to" * getDirectoryPath("/path/to/") === "/path" * getDirectoryPath("/") === "/" @@ -2332,14 +2332,25 @@ namespace ts { } /** - * Gets the portion of a path following the last separator (`/`). + * Returns the path except for its containing directory name. * Semantics align with NodeJS's `path.basename` except that we support URL's as well. + * + * ```ts + * getBaseFileName("/path/to/file.ext") === "file.ext" + * getBaseFileName("/path/to/") === "to" + * getBaseFileName("/") === "" + * ``` */ export function getBaseFileName(path: string): string; /** - * Gets the portion of a path following the last separator (`/`). + * Gets the portion of a path following the last (non-terminal) separator (`/`). * Semantics align with NodeJS's `path.basename` except that we support URL's as well. * If the base name has any one of the provided extensions, it is removed. + * + * ```ts + * getBaseFileName("/path/to/file.ext", ".ext", true) === "file" + * getBaseFileName("/path/to/file.js", ".ext", true) === "file.js" + * ``` */ export function getBaseFileName(path: string, extensions: string | ReadonlyArray, ignoreCase: boolean): string; export function getBaseFileName(path: string, extensions?: string | ReadonlyArray, ignoreCase?: boolean) {