File tree 1 file changed +5
-8
lines changed
1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -538,7 +538,7 @@ namespace ts {
538
538
return pos ;
539
539
}
540
540
541
- let shebangTriviaRegex = / ^ # ! .* / ;
541
+ const shebangTriviaRegex = / ^ # ! .* / ;
542
542
543
543
function isShebangTrivia ( text : string , pos : number ) {
544
544
// Shebangs check must only be done at the start of the file
@@ -644,12 +644,9 @@ namespace ts {
644
644
645
645
/** Optionally, get the shebang */
646
646
export function getShebang ( text : string ) : string {
647
- if ( ! shebangTriviaRegex . test ( text ) ) {
648
- return undefined ;
649
- }
650
- else {
651
- return shebangTriviaRegex . exec ( text ) [ 0 ] ;
652
- }
647
+ return shebangTriviaRegex . test ( text )
648
+ ? shebangTriviaRegex . exec ( text ) [ 0 ]
649
+ : undefined ;
653
650
}
654
651
655
652
export function isIdentifierStart ( ch : number , languageVersion : ScriptTarget ) : boolean {
@@ -1123,7 +1120,7 @@ namespace ts {
1123
1120
let ch = text . charCodeAt ( pos ) ;
1124
1121
1125
1122
// Special handling for shebang
1126
- if ( ch == CharacterCodes . hash && pos === 0 && isShebangTrivia ( text , pos ) ) {
1123
+ if ( ch === CharacterCodes . hash && pos === 0 && isShebangTrivia ( text , pos ) ) {
1127
1124
pos = scanShebangTrivia ( text , pos ) ;
1128
1125
if ( skipTrivia ) {
1129
1126
continue ;
You can’t perform that action at this time.
0 commit comments