@@ -74,13 +74,13 @@ namespace ts {
74
74
}
75
75
76
76
// The global Map object. This may not be available, so we must test for it.
77
- declare const Map : { new < T > ( ) : Map < T > } | undefined ;
77
+ declare const Map : { new < T > ( ) : Map < T > } | undefined ;
78
78
// Internet Explorer's Map doesn't support iteration, so don't use it.
79
79
// tslint:disable-next-line:no-in-operator
80
80
const MapCtr = typeof Map !== "undefined" && "entries" in Map . prototype ? Map : shimMap ( ) ;
81
81
82
82
// Keep the class inside a function so it doesn't get compiled if it's not used.
83
- function shimMap ( ) : { new < T > ( ) : Map < T > } {
83
+ function shimMap ( ) : { new < T > ( ) : Map < T > } {
84
84
85
85
class MapIterator < T , U extends ( string | T | [ string , T ] ) > {
86
86
private data : MapLike < T > ;
@@ -103,7 +103,7 @@ namespace ts {
103
103
}
104
104
}
105
105
106
- return class < T > implements Map < T > {
106
+ return class < T > implements Map < T > {
107
107
private data = createDictionaryObject < T > ( ) ;
108
108
public size = 0 ;
109
109
@@ -166,8 +166,8 @@ namespace ts {
166
166
}
167
167
168
168
export const enum Comparison {
169
- LessThan = - 1 ,
170
- EqualTo = 0 ,
169
+ LessThan = - 1 ,
170
+ EqualTo = 0 ,
171
171
GreaterThan = 1
172
172
}
173
173
@@ -2417,13 +2417,11 @@ namespace ts {
2417
2417
* Takes a string like "jquery-min.4.2.3" and returns "jquery"
2418
2418
*/
2419
2419
export function removeMinAndVersionNumbers ( fileName : string ) {
2420
- const match = / ( ( \w | ( - (? ! m i n ) ) ) + ) ( \. | - ) ? .* / . exec ( fileName ) ;
2421
- if ( match ) {
2422
- return match [ 1 ] ;
2423
- }
2424
- else {
2425
- return fileName ;
2426
- }
2420
+ // Match a "." or "-" followed by a version number or 'min' at the end of the name
2421
+ const trailingMinOrVersion = / [ . - ] ( ( m i n ) | ( \d + ( \. \d + ) * ) ) $ / ;
2422
+
2423
+ // The "min" or version may both be present, in either order, so try applying the above twice.
2424
+ return fileName . replace ( trailingMinOrVersion , "" ) . replace ( trailingMinOrVersion , "" ) ;
2427
2425
}
2428
2426
2429
2427
export interface ObjectAllocator {
@@ -2627,7 +2625,7 @@ namespace ts {
2627
2625
return findBestPatternMatch ( patterns , _ => _ , candidate ) ;
2628
2626
}
2629
2627
2630
- export function patternText ( { prefix, suffix} : Pattern ) : string {
2628
+ export function patternText ( { prefix, suffix } : Pattern ) : string {
2631
2629
return `${ prefix } *${ suffix } ` ;
2632
2630
}
2633
2631
@@ -2657,7 +2655,7 @@ namespace ts {
2657
2655
return matchedValue ;
2658
2656
}
2659
2657
2660
- function isPatternMatch ( { prefix, suffix} : Pattern , candidate : string ) {
2658
+ function isPatternMatch ( { prefix, suffix } : Pattern , candidate : string ) {
2661
2659
return candidate . length >= prefix . length + suffix . length &&
2662
2660
startsWith ( candidate , prefix ) &&
2663
2661
endsWith ( candidate , suffix ) ;
0 commit comments