(langId: LanguageKey, compilerId: string)
| 348 | } |
| 349 | |
| 350 | findCompiler(langId: LanguageKey, compilerId: string): BaseCompiler | undefined { |
| 351 | if (!compilerId) return; |
| 352 | |
| 353 | const langCompilers: Record<string, BaseCompiler> | undefined = this.compilersById[langId]; |
| 354 | if (langCompilers) { |
| 355 | if (langCompilers[compilerId]) { |
| 356 | return langCompilers[compilerId]; |
| 357 | } |
| 358 | const compiler = _.find(langCompilers, (compiler: BaseCompiler) => { |
| 359 | return this.compilerAliasMatch(compiler, compilerId); |
| 360 | }); |
| 361 | |
| 362 | if (compiler) return compiler; |
| 363 | } |
| 364 | |
| 365 | // If the lang is bad, try to find it in every language |
| 366 | let response: BaseCompiler | undefined; |
| 367 | _.each(this.compilersById, (compilerInLang: Record<string, BaseCompiler>) => { |
| 368 | if (!response) { |
| 369 | response = _.find(compilerInLang, (compiler: BaseCompiler) => { |
| 370 | return this.compilerIdOrAliasMatch(compiler, compilerId); |
| 371 | }); |
| 372 | } |
| 373 | }); |
| 374 | |
| 375 | return response; |
| 376 | } |
| 377 | |
| 378 | compilerFor(req): BaseCompiler | undefined { |
| 379 | if (req.is('json')) { |
no test coverage detected