summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRyan Doenges <rhdoenges@gmail.com>2013-04-14 12:44:40 -0700
committerisaacs <i@izs.me>2013-04-19 10:15:22 -0700
commit90266750617adb1ce1ca4ce43fe48f9b0fa11343 (patch)
tree16dcbbefbf4b0d9f8fab8a5fcd8fec9873f39d76 /doc
parente4406b76dfc024cf5a4051dc73018fc447b3dc7f (diff)
downloadnode-90266750617adb1ce1ca4ce43fe48f9b0fa11343.tar.gz
path: add path.isAbsolute(path)
An absolute path will always open the same location regardless of your current working directory. For posix, this just means path.charAt(0) === '/', but on Windows it's a little more complicated. Fixes joyent/node#5299.
Diffstat (limited to 'doc')
-rw-r--r--doc/api/path.markdown19
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/api/path.markdown b/doc/api/path.markdown
index fe59134d4..348c7cdae 100644
--- a/doc/api/path.markdown
+++ b/doc/api/path.markdown
@@ -78,6 +78,25 @@ Examples:
// if currently in /home/myself/node, it returns
'/home/myself/node/wwwroot/static_files/gif/image.gif'
+## path.isAbsolute(path)
+
+Determines whether `path` is an absolute path. An absolute path will always
+resolve to the same location, regardless of the working directory.
+
+Posix examples:
+
+ path.isAbsolute('/foo/bar') // true
+ path.isAbsolute('/baz/..') // true
+ path.isAbsolute('qux/') // false
+ path.isAbsolute('.') // false
+
+Windows examples:
+
+ path.isAbsolute('//server') // true
+ path.isAbsolute('C:/foo/..') // true
+ path.isAbsolute('bar\\baz') // false
+ path.isAbsolute('.') // false
+
## path.relative(from, to)
Solve the relative path from `from` to `to`.