Document that `path.join()` and `path.resolve()` ignore non-string arguments.
authorBen Noordhuis <info@bnoordhuis.nl>
Mon, 4 Jul 2011 16:21:38 +0000 (18:21 +0200)
committerBert Belder <bertbelder@gmail.com>
Mon, 4 Jul 2011 17:40:20 +0000 (19:40 +0200)
Fixes #514.

doc/api/path.markdown

index adef4b3..a074ed5 100644 (file)
@@ -20,13 +20,18 @@ Example:
 ### path.join([path1], [path2], [...])
 
 Join all arguments together and normalize the resulting path.
+Non-string arguments are ignored.
 
 Example:
 
-    node> require('path').join(
-    ...   '/foo', 'bar', 'baz/asdf', 'quux', '..')
+    path.join('/foo', 'bar', 'baz/asdf', 'quux', '..')
+    // returns
     '/foo/bar/baz/asdf'
 
+    path.join('foo', {}, 'bar')
+    // returns
+    'foo/bar'
+
 ### path.resolve([from ...], to)
 
 Resolves `to` to an absolute path.
@@ -35,7 +40,7 @@ If `to` isn't already absolute `from` arguments are prepended in right to left
 order, until an absolute path is found. If after using all `from` paths still
 no absolute path is found, the current working directory is used as well. The
 resulting path is normalized, and trailing slashes are removed unless the path 
-gets resolved to the root directory.
+gets resolved to the root directory. Non-string arguments are ignored.
 
 Another way to think of it is as a sequence of `cd` commands in a shell.