Skip to content
Closed
Next Next commit
docs: explain why path.posix.normalize does not replace windows slashes
Add section to path docs that explains that path.posix.normalize
does not replace Windows slashes with POSIX slashes because POSIX
does not recognize / as a valid path separator.

Fixes: #12298
  • Loading branch information
sjlehn committed Apr 27, 2017
commit c6f50de6530da6a615a1e575acd59f4ab9677e5f
10 changes: 10 additions & 0 deletions doc/api/path.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,16 @@ added: v0.11.15
The `path.posix` property provides access to POSIX specific implementations
of the `path` methods.

### path.posix.normalize(path)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this note belongs in the normalize() documentation, not as a different subsection in path.posix.

Copy link
Copy Markdown
Contributor Author

@sjlehn sjlehn Apr 27, 2017

Choose a reason for hiding this comment

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

Should I still give it a heading or would it be better as just a note after "For Example, on POSIX" at 327

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wouldn't give it a heading.

The `path.posix.normalize()` method will not attempt to convert / (Windows) to \ (POSIX), as / is not recognized by
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

long line here. Please line break at 80 chars :-)

POSIX as a valid directory separator.

For example:
```js
path.posix.normalize("/some/thing/like/this")
//Returns '/some/thing/like/this'
```

## path.relative(from, to)
<!-- YAML
added: v0.5.0
Expand Down