diff options
author | Rich Trott <rtrott@gmail.com> | 2022-09-27 04:48:55 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2022-10-05 13:52:56 +0300 |
commit | fd5c26b8db350184d437002c181c24f7235607fa (patch) | |
tree | 08f9ec6087822ad01ec9530514bd7ae5441ea179 /doc | |
parent | e9d572a9bd2f6d8a3f40b4a1f3b44dac965a072d (diff) |
path: change basename() argument from ext to suffix
Closes: https://github.com/nodejs/node/issues/44773
PR-URL: https://github.com/nodejs/node/pull/44774
Fixes: https://github.com/nodejs/node/issues/44773
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/path.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/api/path.md b/doc/api/path.md index 0bbb5b80c57..5b66e54f939 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -62,7 +62,7 @@ example, `path.resolve('C:\\')` can potentially return a different result than `path.resolve('C:')`. For more information, see [this MSDN page][MSDN-Rel-Path]. -## `path.basename(path[, ext])` +## `path.basename(path[, suffix])` <!-- YAML added: v0.1.25 @@ -73,12 +73,12 @@ changes: --> * `path` {string} -* `ext` {string} An optional file extension +* `suffix` {string} An optional suffix to remove * Returns: {string} The `path.basename()` method returns the last portion of a `path`, similar to -the Unix `basename` command. Trailing directory separators are ignored, see -[`path.sep`][]. +the Unix `basename` command. Trailing [directory separators][`path.sep`] are +ignored. ```js path.basename('/foo/bar/baz/asdf/quux.html'); @@ -101,7 +101,7 @@ path.win32.basename('C:\\foo.HTML', '.html'); // Returns: 'foo.HTML' ``` -A [`TypeError`][] is thrown if `path` is not a string or if `ext` is given +A [`TypeError`][] is thrown if `path` is not a string or if `suffix` is given and is not a string. ## `path.delimiter` |