From 290faec0e75f3f71dc9f742b875375c3be53703f Mon Sep 17 00:00:00 2001 From: himself65 Date: Fri, 19 Apr 2019 13:21:37 +0800 Subject: [PATCH] doc: fix extname with the correct description PR-URL: https://github.com/nodejs/node/pull/27303 Reviewed-By: Ruben Bridgewater Reviewed-By: Vse Mozhet Byt Reviewed-By: Yongsheng Zhang --- doc/api/path.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/api/path.md b/doc/api/path.md index 0248d5dbb59e79..8752eb5fdc56c2 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -157,9 +157,9 @@ changes: The `path.extname()` method returns the extension of the `path`, from the last occurrence of the `.` (period) character to end of string in the last portion of -the `path`. If there is no `.` in the last portion of the `path`, or if the -first character of the basename of `path` (see `path.basename()`) is `.`, then -an empty string is returned. +the `path`. If there is no `.` in the last portion of the `path`, or if +there are no `.` characters other than the first character of +the basename of `path` (see `path.basename()`) , an empty string is returned. ```js path.extname('index.html'); @@ -176,6 +176,9 @@ path.extname('index'); path.extname('.index'); // Returns: '' + +path.extname('.index.md'); +// Returns: '.md' ``` A [`TypeError`][] is thrown if `path` is not a string.