File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -538,7 +538,7 @@ namespace ts {
538538 return pos ;
539539 }
540540
541- let shebangTriviaRegex = / ^ # ! .* / ;
541+ const shebangTriviaRegex = / ^ # ! .* / ;
542542
543543 function isShebangTrivia ( text : string , pos : number ) {
544544 // Shebangs check must only be done at the start of the file
@@ -644,12 +644,9 @@ namespace ts {
644644
645645 /** Optionally, get the shebang */
646646 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 ;
653650 }
654651
655652 export function isIdentifierStart ( ch : number , languageVersion : ScriptTarget ) : boolean {
@@ -1123,7 +1120,7 @@ namespace ts {
11231120 let ch = text . charCodeAt ( pos ) ;
11241121
11251122 // Special handling for shebang
1126- if ( ch == CharacterCodes . hash && pos === 0 && isShebangTrivia ( text , pos ) ) {
1123+ if ( ch === CharacterCodes . hash && pos === 0 && isShebangTrivia ( text , pos ) ) {
11271124 pos = scanShebangTrivia ( text , pos ) ;
11281125 if ( skipTrivia ) {
11291126 continue ;
You can’t perform that action at this time.
0 commit comments