path: remove StringPrototypeCharCodeAt
from posix.extname
PR-URL: https://github.com/nodejs/node/pull/54546 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
7c58645aca
commit
94a457a1eb
@ -1462,8 +1462,8 @@ const posix = {
|
|||||||
// after any path separator we find
|
// after any path separator we find
|
||||||
let preDotState = 0;
|
let preDotState = 0;
|
||||||
for (let i = path.length - 1; i >= 0; --i) {
|
for (let i = path.length - 1; i >= 0; --i) {
|
||||||
const code = StringPrototypeCharCodeAt(path, i);
|
const char = path[i];
|
||||||
if (code === CHAR_FORWARD_SLASH) {
|
if (char === '/') {
|
||||||
// If we reached a path separator that was not part of a set of path
|
// If we reached a path separator that was not part of a set of path
|
||||||
// separators at the end of the string, stop now
|
// separators at the end of the string, stop now
|
||||||
if (!matchedSlash) {
|
if (!matchedSlash) {
|
||||||
@ -1478,7 +1478,7 @@ const posix = {
|
|||||||
matchedSlash = false;
|
matchedSlash = false;
|
||||||
end = i + 1;
|
end = i + 1;
|
||||||
}
|
}
|
||||||
if (code === CHAR_DOT) {
|
if (char === '.') {
|
||||||
// If this is our first dot, mark it as the start of our extension
|
// If this is our first dot, mark it as the start of our extension
|
||||||
if (startDot === -1)
|
if (startDot === -1)
|
||||||
startDot = i;
|
startDot = i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user