diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2011-07-04 20:21:38 +0400 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2011-07-04 21:40:20 +0400 |
commit | 20d7c47d6e591f1dc40f9c1901f8f8cc8580ef2a (patch) | |
tree | ea2a61b4b99868679ff13b4f6717207a89307f70 /doc | |
parent | 02ebcd8e261d7a30b5873548d527a1b6b9ae8e98 (diff) |
Document that `path.join()` and `path.resolve()` ignore non-string arguments.
Fixes #514.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/path.markdown | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/doc/api/path.markdown b/doc/api/path.markdown index adef4b39ed6..a074ed59b2d 100644 --- a/doc/api/path.markdown +++ b/doc/api/path.markdown @@ -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. |