Skip to content

Commit

Permalink
path: remove StringPrototypeCharCodeAt from posix.extname
Browse files Browse the repository at this point in the history
PR-URL: #54546
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
RedYetiDev authored and aduh95 committed Sep 13, 2024
1 parent 5f02e1b commit 94fb7ab
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 94fb7ab

Please sign in to comment.