Skip to content

Commit

Permalink
path: remove StringPrototypeCharCodeAt from posix.extname
Browse files Browse the repository at this point in the history
PR-URL: nodejs#54546
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
RedYetiDev authored and louwers committed Nov 2, 2024
1 parent 7e9bdc6 commit 8650265
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 8650265

Please sign in to comment.