-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: path.resolve ignores zero-length strings #5928
Conversation
I get cwd for zero length strings. What you're seeing is what happens when you have a
See in https://github.com/nodejs/node/blob/master/lib/path.js#L1183 , it sets it to the cwd before that Thanks for coming by and wanting to make a contribution to the docs :) This one is by design though. |
Maybe it would be appropriate to change the text to "are all zero length strings" or something similar |
In the beginning of |
I'm +0 on this - not sure it helps clarify too much, but LGTM. I want to know what other docs members think about these sort of changes @nodejs/documentation |
LGTM though I am also not sure if clarifies it more, but largely because of the API itself. Maybe we could have an issue to rewrite this whole doc part. |
LGTM |
https://github.com/nodejs/node/blob/master/lib/path.js#L187 https://github.com/nodejs/node/blob/master/lib/path.js#L1189 PR-URL: #5928 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Jefe Lindstädt <robert.lindstaedt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 4c234df |
It looks like this change is not applicable to v5.x or v4.x There was originally copy that mentioned this that was removed in an edit |
https://github.com/nodejs/node/blob/master/lib/path.js#L187 https://github.com/nodejs/node/blob/master/lib/path.js#L1189 PR-URL: nodejs#5928 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Jefe Lindstädt <robert.lindstaedt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
https://github.com/nodejs/node/blob/master/lib/path.js#L187 https://github.com/nodejs/node/blob/master/lib/path.js#L1189 PR-URL: #5928 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Jefe Lindstädt <robert.lindstaedt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
path.resolve
does not usecwd
for zero-length strings as written in docs. Instead it just skips them when iterating.https://github.com/nodejs/node/blob/master/lib/path.js#L187
https://github.com/nodejs/node/blob/master/lib/path.js#L1189