Skip to content

Conversation

@irengrig
Copy link

  • for the case when we can just return the original value, maybe correcting the path separators

- for the case when we can just return the original value, maybe correcting the path separators
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/path

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. path Issues and PRs related to the path subsystem. labels Oct 28, 2025
Comment on lines +96 to +97
const otherSeparator = separator === CHAR_FORWARD_SLASH ? CHAR_BACKWARD_SLASH : CHAR_FORWARD_SLASH;
return path.replaceAll(otherSeparator, separator);
Copy link
Member

@ChALkeR ChALkeR Oct 28, 2025

Choose a reason for hiding this comment

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

This will fail on the following case:

> path.normalize('a\\d')
'a\\d'
> path.posix.normalize('a\\d')
'a\\d'

This code misses that isPathSeparator is an argument and could be isPosixPathSeparator.

Copy link
Member

@himself65 himself65 left a comment

Choose a reason for hiding this comment

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

Should the title be the pref: ...

And can you run the benchmark to see the performance improvement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. path Issues and PRs related to the path subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants