Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
path: remove StringPrototypeCharCodeAt from posix.extname
  • Loading branch information
avivkeller authored Aug 24, 2024
commit 6fb659b046732f59bdc361fed160bc557aeffa53
6 changes: 3 additions & 3 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -1462,8 +1462,8 @@ const posix = {
// after any path separator we find
let preDotState = 0;
for (let i = path.length - 1; i >= 0; --i) {
const code = StringPrototypeCharCodeAt(path, i);
if (code === CHAR_FORWARD_SLASH) {
const char = path[i];
if (char === '/') {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
Expand All @@ -1478,7 +1478,7 @@ const posix = {
matchedSlash = false;
end = i + 1;
}
if (code === CHAR_DOT) {
if (char === '.') {
// If this is our first dot, mark it as the start of our extension
if (startDot === -1)
startDot = i;
Expand Down