Use .find instead of .filter()[i]

This commit is contained in:
Kallum Jones 2022-08-10 01:19:21 +01:00
parent c0f6be93c7
commit 562b43e0b0
No known key found for this signature in database
GPG Key ID: D7F4589C4D7F81A9
1 changed files with 1 additions and 1 deletions

View File

@ -203,7 +203,7 @@ export default class Mods {
}
static getSourceFromName(name: string): ModSource {
const source = this.MOD_SOURCES.filter(src => src.getSourceName() === name)[0];
const source = this.MOD_SOURCES.find(src => src.getSourceName() === name);
if (source == undefined) {
throw new Error(`There is no source registered with the name ${name}`)
}