Document that path.join() and path.resolve() ignore non-string arguments.

Fixes #514.
This commit is contained in:
Ben Noordhuis
2011-07-04 18:21:38 +02:00
committed by Bert Belder
parent 02ebcd8e26
commit 20d7c47d6e

View 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.