Skip to content

Commit e0aca41

Browse files
committed
Responding to PR feedback
1 parent 0966ebc commit e0aca41

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/compiler/core.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -987,17 +987,17 @@ namespace ts {
987987
// The * and ? wildcards should not match directories or files that start with . if they
988988
// appear first in a component. Dotted directories and files can be included explicitly
989989
// like so: **/.*/.*
990-
if (component.indexOf("*") === 0) {
990+
if (component.charCodeAt(0) === CharacterCodes.asterisk) {
991991
subpattern += "([^./]" + singleAsteriskRegexFragment + ")?";
992992
component = component.substr(1);
993993
}
994-
else if (component.indexOf("?") === 0) {
994+
else if (component.charCodeAt(0) === CharacterCodes.question) {
995995
subpattern += "[^./]";
996996
component = component.substr(1);
997997
}
998998
}
999999

1000-
subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
1000+
subpattern += replaceWildcardCharacters(component, singleAsteriskRegexFragment);
10011001
hasWrittenComponent = true;
10021002
}
10031003
}
@@ -1020,6 +1020,10 @@ namespace ts {
10201020
}
10211021

10221022
return "^(" + pattern + (usage === "exclude" ? ")($|/)" : ")$");
1023+
}
1024+
1025+
function replaceWildcardCharacters(component: string, singleAsteriskRegexFragment: string) {
1026+
return component.replace(reservedCharacterPattern, replaceWildcardCharacter);
10231027

10241028
function replaceWildcardCharacter(match: string) {
10251029
return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;

0 commit comments

Comments
 (0)