This commit is contained in:
toasted-nutbread 2020-02-15 12:30:07 -05:00
parent 452eec8a88
commit 886278b19d

View File

@ -400,16 +400,12 @@ class Translator {
async findKanji(text, options) { async findKanji(text, options) {
const dictionaries = dictEnabledSet(options); const dictionaries = dictEnabledSet(options);
const titles = Object.keys(dictionaries); const titles = Object.keys(dictionaries);
const kanjiUnique = {}; const kanjiUnique = new Set();
const kanjiList = [];
for (const c of text) { for (const c of text) {
if (!hasOwn(kanjiUnique, c)) { kanjiUnique.add(c);
kanjiList.push(c);
kanjiUnique[c] = true;
}
} }
const definitions = await this.database.findKanjiBulk(kanjiList, titles); const definitions = await this.database.findKanjiBulk([...kanjiUnique], titles);
if (definitions.length === 0) { if (definitions.length === 0) {
return definitions; return definitions;
} }