From 20d7c47d6e591f1dc40f9c1901f8f8cc8580ef2a Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 4 Jul 2011 18:21:38 +0200 Subject: [PATCH] Document that `path.join()` and `path.resolve()` ignore non-string arguments. Fixes #514. --- doc/api/path.markdown | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/api/path.markdown b/doc/api/path.markdown index adef4b3..a074ed5 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. -- 2.7.4