doc: update path.extname documentation
authorJames M Snell <jasnell@gmail.com>
Fri, 14 Aug 2015 17:25:10 +0000 (10:25 -0700)
committerJames M Snell <jasnell@gmail.com>
Wed, 26 Aug 2015 01:51:41 +0000 (18:51 -0700)
per: https://github.com/joyent/node/pull/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 <thechargingvolcano@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/2378

doc/api/path.markdown

index 8774912..7a06ec6 100644 (file)
@@ -183,6 +183,10 @@ an empty string.  Examples:
     // returns
     ''
 
+    path.extname('.index')
+    // returns
+    ''
+
 ## path.sep
 
 The platform-specific file separator. `'\\'` or `'/'`.