Skip to content

Commit

Permalink
improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Casheeew committed Jan 14, 2024
1 parent 7e90cd1 commit 749f337
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions ext/js/dictionary/dictionary-importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,18 +691,19 @@ export class DictionaryImporter {
_getArchiveFiles(fileMap, queryDetails) {
/** @type {import('dictionary-importer').QueryResult} */
const results = new Map();

for (const [fileType] of queryDetails) {
results.set(fileType, []);
}

for (const [fileName, fileEntry] of fileMap.entries()) {
for (const [fileType, fileNameFormat] of queryDetails) {
let entries = results.get(fileType);
if (typeof entries === 'undefined') {
entries = [];
results.set(fileType, entries);
}
if (!fileNameFormat.test(fileName)) { continue; }
const entries = results.get(fileType);

if (fileNameFormat.test(fileName)) {
entries.push(fileEntry);
break;
}
// @ts-expect-error - entries should be initialized
entries.push(fileEntry);
break;
}
}
return results;
Expand Down

0 comments on commit 749f337

Please sign in to comment.