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

docs: explain why path.posix.normalize does not replace windows slashes #12700

Closed
wants to merge 6 commits into from
9 changes: 9 additions & 0 deletions doc/api/path.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,15 @@ For example on POSIX:
path.normalize('/foo/bar//baz/asdf/quux/..');
// Returns: '/foo/bar/baz/asdf'
```
*Note*: The `path.posix.normalize()` method will not attempt to convert \
(Windows) to / (POSIX), as \ is not recognized by POSIX as a valid directory
separator.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: wrap the \ and / in backticks...

`\` and `/`


For example:
```js
path.posix.normalize("\\some\\thing\\like\\this")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: include .. in the sample path to show that those segments are not removed from the normalized path.

//Returns '\some\thing\like\this'
```

On Windows:

Expand Down