Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Update path.extname documentation #8509

Closed
wants to merge 1 commit into from

Conversation

thauburger
Copy link

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.

Adding an additional example to `path.extname` to demonstrate the case where the first letter of the last path component is `'.'`. This case is  an interesting one, as `path.extname('.txt')`, returns an empty string. In this case, `.txt` is a potentially valid file name with some semantic value as a text file (while arguably maintaining an extension). I agree with Node's behavior in this case, but  I think the added example provides clarity on the method's behavior.
@trevnorris
Copy link

LGTM

@chrisdickinson feel free to fix the commit message and land.

@jasnell
Copy link
Member

jasnell commented Aug 14, 2015

Closing this here. New PR opened.

@jasnell jasnell closed this Aug 14, 2015
jasnell added a commit to jasnell/node that referenced this pull request Aug 26, 2015
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.
jasnell added a commit to nodejs/node that referenced this pull request Aug 26, 2015
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
jasnell added a commit to nodejs/node that referenced this pull request Aug 26, 2015
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants