Skip to content
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

path.resolve: clarify the example #25542

Closed
YakovL opened this issue Jan 16, 2019 · 2 comments
Closed

path.resolve: clarify the example #25542

YakovL opened this issue Jan 16, 2019 · 2 comments

Comments

@YakovL
Copy link
Contributor

YakovL commented Jan 16, 2019

https://nodejs.org/api/path.html#path_path_resolve_paths states:

The given sequence of paths is processed from right to left, with each subsequent path prepended until an absolute path is constructed. For instance, given the sequence of path segments: /foo, /bar, baz, calling path.resolve('/foo', '/bar', 'baz') would return /bar/baz.

This is something a bit diffucult to grab when in hurry (first though is: why that wouldn't be /foo/bar/baz?). One thing is "prepend" is meant not literally (otherwise that would be /barbaz). The other is the whole idea is not very usual. My suggestion is to expand this into:

The given sequence of paths is processed from right to left, with each subsequent path prepended until an absolute path is constructed. For instance, given the sequence of path segments: /foo, /bar, baz, calling path.resolve('/foo', '/bar', 'baz') would return /bar/baz because 'baz' is not an absolute path but '/bar' + '/' + 'baz' is.

But may be this is trivial for others, so I'd like to get some feedback before creating a PR.

@gireeshpunathil
Copy link
Member

The other is the whole idea is not very usual.

👍

I'd like to get some feedback before creating a PR.

👍

@JLeClerc
Copy link

JLeClerc commented Jan 16, 2020

+1 to this. It could use some clarification.

YakovL added a commit to YakovL/node that referenced this issue Jan 20, 2020
@Trott Trott closed this as completed in 4e3dee4 Jan 23, 2020
codebytere pushed a commit that referenced this issue Feb 17, 2020
Fixes: #25542

PR-URL: #31430
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
codebytere pushed a commit that referenced this issue Mar 15, 2020
Fixes: #25542

PR-URL: #31430
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
codebytere pushed a commit that referenced this issue Mar 17, 2020
Fixes: #25542

PR-URL: #31430
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants