Skip to content

Commit 3a27437

Browse files
Only fetch the next character when necessary.
1 parent baaa850 commit 3a27437

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/compiler/path.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,18 +644,17 @@ function isNotNormalizedOrAbsolute(s: string) {
644644

645645
for (let i = 0, n = s.length - 1; i < n; i++) {
646646
const curr = s.charCodeAt(i);
647-
const next = s.charCodeAt(i + 1);
648647
if (curr === CharacterCodes.dot) {
649648
// A ./ or ../ must be reduced - not normalized.
650-
if (next === CharacterCodes.slash) {
649+
if (s.charCodeAt(i + 1) === CharacterCodes.slash) {
651650
return true;
652651
}
653652
}
654653
else if (curr === CharacterCodes.slash) {
655654
// Multiple slashes in a row (outside of the root,
656655
// and there is no root) must be reduced to a single slash.
657656
// So the path is not normalized.
658-
if (next === CharacterCodes.slash) {
657+
if (s.charCodeAt(i + 1) === CharacterCodes.slash) {
659658
return true;
660659
}
661660
}

0 commit comments

Comments
 (0)