Skip to content

Commit 3d4bc20

Browse files
Format.
1 parent 123b7c3 commit 3d4bc20

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/compiler/utilities.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10017,21 +10017,21 @@ const parsedPatternsCache = new WeakMap<MapLike<string[]>, ParsedPatterns>();
1001710017
* Divides patterns into a set of exact specifiers and sorted patterns.
1001810018
* NOTE that this function caches, and assumes the same `paths` argument will
1001910019
* never be provided with a different value for `sortByAggregateLength`.
10020-
*
10020+
*
1002110021
* @internal
10022-
**/
10022+
*/
1002310023
export function tryParsePatterns(paths: MapLike<string[]>, sortByAggregateLength: boolean = false): ParsedPatterns {
10024-
let result = parsedPatternsCache.get(paths)
10024+
let result = parsedPatternsCache.get(paths);
1002510025
if (result !== undefined) {
1002610026
return result;
1002710027
}
1002810028

1002910029
let matchableStringSet: Set<string> | undefined;
1003010030
let sortedPatterns: Pattern[] | undefined;
10031-
10031+
1003210032
const pathList = getOwnKeys(paths);
1003310033
for (const path of pathList) {
10034-
const patternOrStr = tryParsePattern(path)
10034+
const patternOrStr = tryParsePattern(path);
1003510035
if (patternOrStr === undefined) {
1003610036
continue;
1003710037
}
@@ -10044,17 +10044,20 @@ export function tryParsePatterns(paths: MapLike<string[]>, sortByAggregateLength
1004410044
}
1004510045

1004610046
sortedPatterns?.sort((a, b) => {
10047-
const prefixComparison = compareStringsCaseSensitive(a.prefix, b.prefix)
10047+
const prefixComparison = compareStringsCaseSensitive(a.prefix, b.prefix);
1004810048
if (prefixComparison === 0 && sortByAggregateLength) {
1004910049
return a.suffix.length - b.suffix.length;
1005010050
}
1005110051
return prefixComparison;
1005210052
});
1005310053

10054-
parsedPatternsCache.set(paths, result = {
10055-
matchableStringSet,
10056-
sortedPatterns,
10057-
});
10054+
parsedPatternsCache.set(
10055+
paths,
10056+
result = {
10057+
matchableStringSet,
10058+
sortedPatterns,
10059+
},
10060+
);
1005810061

1005910062
return result;
1006010063
}

0 commit comments

Comments
 (0)