Browse Source

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

Fixes #514.
v0.7.4-release
Ben Noordhuis 14 years ago
committed by Bert Belder
parent
commit
20d7c47d6e
  1. 11
      doc/api/path.markdown

11
doc/api/path.markdown

@ -20,13 +20,18 @@ Example:
### path.join([path1], [path2], [...]) ### path.join([path1], [path2], [...])
Join all arguments together and normalize the resulting path. Join all arguments together and normalize the resulting path.
Non-string arguments are ignored.
Example: Example:
node> require('path').join( path.join('/foo', 'bar', 'baz/asdf', 'quux', '..')
... '/foo', 'bar', 'baz/asdf', 'quux', '..') // returns
'/foo/bar/baz/asdf' '/foo/bar/baz/asdf'
path.join('foo', {}, 'bar')
// returns
'foo/bar'
### path.resolve([from ...], to) ### path.resolve([from ...], to)
Resolves `to` to an absolute path. 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 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 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 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. Another way to think of it is as a sequence of `cd` commands in a shell.

Loading…
Cancel
Save