File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1218,23 +1218,7 @@ namespace ts {
12181218 export function isExternalModuleNameRelative ( moduleName : string ) : boolean {
12191219 // TypeScript 1.0 spec (April 2014): 11.2.1
12201220 // An external module name is "relative" if the first term is "." or "..".
1221- if ( moduleName . charCodeAt ( 0 ) === CharacterCodes . dot ) {
1222- if ( moduleName . length === 1 ) {
1223- return true ;
1224- }
1225- switch ( moduleName . charCodeAt ( 1 ) ) {
1226- case CharacterCodes . slash :
1227- case CharacterCodes . backslash :
1228- return true ;
1229- case CharacterCodes . dot :
1230- if ( moduleName . length === 2 ) {
1231- return true ;
1232- }
1233- const ch2 = moduleName . charCodeAt ( 2 ) ;
1234- return ch2 === CharacterCodes . slash || ch2 === CharacterCodes . backslash ;
1235- }
1236- }
1237- return false ;
1221+ return / ^ \. \. ? ( $ | [ \\ / ] ) / . test ( moduleName ) ;
12381222 }
12391223
12401224 export function isInstantiatedModule ( node : ModuleDeclaration , preserveConstEnums : boolean ) {
You can’t perform that action at this time.
0 commit comments