Skip to content

Commit b5da894

Browse files
jasnellrvagg
authored andcommitted
doc: update path.extname documentation
per: nodejs/node-v0.x-archive#8509 originally submitted by @thauburger Adding an additional example to path.extname documentation to demonstrate the case where the first character of the last path component is '.'. This case is interesting, as something like path.extname('.txt') returns an empty string. In this case, .txt can be used as a valid file name (while arguably maintaining an extension). I agree with Node's behavior in this case, but I think the added example provides additional clarity for the developer. Reviewed By: Sakthipriyan Vairamani <[email protected]> PR-URL: #2378
1 parent 1d4ea60 commit b5da894

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/api/path.markdown

+4
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ an empty string. Examples:
183183
// returns
184184
''
185185

186+
path.extname('.index')
187+
// returns
188+
''
189+
186190
## path.sep
187191

188192
The platform-specific file separator. `'\\'` or `'/'`.

0 commit comments

Comments
 (0)