Skip to content

Commit 767ff59

Browse files
committed
modify LanguageNormalizer.ts
1 parent a9e6a2e commit 767ff59

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
const mapping: [beginning: string, normalized: string][] = [
2+
["PyPy", "Python"],
3+
["Python (Cython", "Cython"],
4+
["Assembly x64", "Assembly x64"],
5+
["Awk", "AWK"],
6+
["IOI-Style", "C++"],
7+
["LuaJIT", "Lua"],
8+
["Seed7", "Seed7"],
9+
["Perl6", "Raku"],
10+
["Objective-C", "Objective-C"],
11+
];
12+
113
export const normalizeLanguage = (language: string): string => {
2-
if (language.startsWith("Perl6")) {
3-
return "Raku";
4-
} else {
5-
return language.replace(/\d*\s*\(.*\)$/, "");
14+
for (const [beginning, normalized] of mapping) {
15+
if (language.startsWith(beginning)) {
16+
return normalized;
17+
}
618
}
19+
20+
return language.replace(/\s*[\d(\-].*/, "") || "Unknown";
721
};

0 commit comments

Comments
 (0)