Skip to content

Commit

Permalink
Replace dictionaryInfoMap with find
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuuuube committed Dec 17, 2024
1 parent 16ace1a commit de6379f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions ext/js/pages/settings/dictionary-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,17 +836,11 @@ export class DictionaryController {
entry.cleanup();
}

/** @type {Map<string, import('dictionary-importer').Summary>} */
const dictionaryInfoMap = new Map();
for (const dictionary of dictionaries) {
dictionaryInfoMap.set(dictionary.title, dictionary);
}

const dictionaryOptionsArray = options.dictionaries;
for (let i = 0, ii = dictionaryOptionsArray.length; i < ii; ++i) {
const {name} = dictionaryOptionsArray[i];
/** @type {import('dictionary-importer').Summary | undefined} */
const dictionaryInfo = dictionaryInfoMap.get(name);
const dictionaryInfo = dictionaries.find((dictionary) => dictionary.title === name);
if (typeof dictionaryInfo === 'undefined') { continue; }
const updateDownloadUrl = dictionaryInfo.downloadUrl ?? null;
this._createDictionaryEntry(i, dictionaryInfo, updateDownloadUrl);
Expand Down

0 comments on commit de6379f

Please sign in to comment.