-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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: general improvements to path.md copy #7122
Conversation
|
||
The file system is not consulted to determine if paths are valid. | ||
|
||
## Windows vs. posix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POSIX should probably be capitalized everywhere, except for path.posix
code references of course.
Updated :-) |
* `[, ...]` {String} Additional path segments | ||
|
||
The `path.join()` method join all given path segments together using the | ||
platform specific separator (`path.sep`) as a delimiter, then normalizes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Referencing path.sep
specifically here may be a bit misleading in case someone tries to modify path.sep
, since path.sep
is not actually used internally by the path functions.
Updated :-) |
The `path.normalize()` method normalizes a path, resolving `'..'` and `'.'` | ||
segments. | ||
|
||
When multiple, sequential `/` (slash) characters are found, they are replaced |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be reworded to not mention specific slash characters and instead use wording like 'platform specific path segment separator' or something shorter (but still differentiates from the platform specific path separator -- ;
or :
).
Done |
## path.posix | ||
|
||
Provide access to aforementioned `path` methods but always interact in a posix | ||
compatible way. | ||
The `path.posix' property provides access to POSIX specific implementations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The '
should be a backtick.
Updated! |
The resulting path is normalized and trailing slashes are removed unless the | ||
path is resolved to the root directory. | ||
|
||
Any `path` segments passed as empty strings are ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds a bit odd, what about 'Any empty path
strings are ignored.'?
Updated |
ping @mscdex |
@@ -2,37 +2,93 @@ | |||
|
|||
Stability: 2 - Stable | |||
|
|||
This module contains utilities for handling and transforming file | |||
paths. The file system is not consulted to check whether paths are valid. | |||
The `path` module provides utilities for working with file paths. It can be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit: s/file/file/directory/ or s/file/file system/ ? Although the latter makes it sounds like it necessarily touches the file system, which is not always the case.
|
||
## path.basename(path[, ext]) | ||
<!-- YAML | ||
added: v0.1.25 | ||
--> | ||
|
||
Return the last portion of a path, similar to the Unix `basename` command. | ||
`path` must be a string. `ext`, if given, must also be a string. | ||
* `path` {String} A file path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/A file path// here and all of the other instances
@mscdex ... updated! |
LGTM |
PR-URL: #7122 Reviewed-By: Brian White <[email protected]>
Landed in a173483 |
PR-URL: #7122 Reviewed-By: Brian White <[email protected]>
Checklist
Affected core subsystem(s)
doc (path)
Description of change
General improvements to path.md documentation
@nodejs/documentation