File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
atcoder-problems-frontend/src/utils Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 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+
113export 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} ;
You can’t perform that action at this time.
0 commit comments