diff --git a/lib/path.js b/lib/path.js index e1e2591bfc448a..05989794958ab8 100644 --- a/lib/path.js +++ b/lib/path.js @@ -1463,8 +1463,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) { @@ -1479,7 +1479,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;