mirror of https://github.com/nodejs/node.git
doc: fix extname with the correct description
PR-URL: https://github.com/nodejs/node/pull/27303 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>pull/27216/head
parent
5356b4a675
commit
290faec0e7
|
@ -157,9 +157,9 @@ changes:
|
||||||
|
|
||||||
The `path.extname()` method returns the extension of the `path`, from the last
|
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
|
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
|
the `path`. If there is no `.` in the last portion of the `path`, or if
|
||||||
first character of the basename of `path` (see `path.basename()`) is `.`, then
|
there are no `.` characters other than the first character of
|
||||||
an empty string is returned.
|
the basename of `path` (see `path.basename()`) , an empty string is returned.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
path.extname('index.html');
|
path.extname('index.html');
|
||||||
|
@ -176,6 +176,9 @@ path.extname('index');
|
||||||
|
|
||||||
path.extname('.index');
|
path.extname('.index');
|
||||||
// Returns: ''
|
// Returns: ''
|
||||||
|
|
||||||
|
path.extname('.index.md');
|
||||||
|
// Returns: '.md'
|
||||||
```
|
```
|
||||||
|
|
||||||
A [`TypeError`][] is thrown if `path` is not a string.
|
A [`TypeError`][] is thrown if `path` is not a string.
|
||||||
|
|
Loading…
Reference in New Issue