-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Description
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
, callingpath.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
, callingpath.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.