We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9e6a2e commit 767ff59Copy full SHA for 767ff59
1 file changed
atcoder-problems-frontend/src/utils/LanguageNormalizer.ts
@@ -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
+
13
export const normalizeLanguage = (language: string): string => {
- if (language.startsWith("Perl6")) {
- return "Raku";
- } else {
- return language.replace(/\d*\s*\(.*\)$/, "");
14
+ for (const [beginning, normalized] of mapping) {
15
+ if (language.startsWith(beginning)) {
16
+ return normalized;
17
+ }
18
}
19
20
+ return language.replace(/\s*[\d(\-].*/, "") || "Unknown";
21
};
0 commit comments