diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-02-15 15:01:21 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-02-22 14:43:05 -0500 |
commit | cc2e21cd866fd02120c593f6a5ad9b5840c0edbb (patch) | |
tree | 6cc89571f083574a881e33b3cb963ee29a575626 /ext/bg/js/database.js | |
parent | b0c566417ff15a7b9b71b7a1e019025a84842d2c (diff) |
Use Map for dictEnabledSet
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r-- | ext/bg/js/database.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index db59f982..1f6810cf 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -149,14 +149,14 @@ class Database { await Promise.all(promises); } - async findTermsBulk(termList, titles, wildcard) { + async findTermsBulk(termList, dictionaries, wildcard) { this._validate(); const promises = []; const visited = new Set(); const results = []; const processRow = (row, index) => { - if (titles.includes(row.dictionary) && !visited.has(row.id)) { + if (dictionaries.has(row.dictionary) && !visited.has(row.id)) { visited.add(row.id); results.push(Database._createTerm(row, index)); } @@ -184,13 +184,13 @@ class Database { return results; } - async findTermsExactBulk(termList, readingList, titles) { + async findTermsExactBulk(termList, readingList, dictionaries) { this._validate(); const promises = []; const results = []; const processRow = (row, index) => { - if (row.reading === readingList[index] && titles.includes(row.dictionary)) { + if (row.reading === readingList[index] && dictionaries.has(row.dictionary)) { results.push(Database._createTerm(row, index)); } }; @@ -234,16 +234,16 @@ class Database { return results; } - async findTermMetaBulk(termList, titles) { - return this._findGenericBulk('termMeta', 'expression', termList, titles, Database._createTermMeta); + async findTermMetaBulk(termList, dictionaries) { + return this._findGenericBulk('termMeta', 'expression', termList, dictionaries, Database._createTermMeta); } - async findKanjiBulk(kanjiList, titles) { - return this._findGenericBulk('kanji', 'character', kanjiList, titles, Database._createKanji); + async findKanjiBulk(kanjiList, dictionaries) { + return this._findGenericBulk('kanji', 'character', kanjiList, dictionaries, Database._createKanji); } - async findKanjiMetaBulk(kanjiList, titles) { - return this._findGenericBulk('kanjiMeta', 'character', kanjiList, titles, Database._createKanjiMeta); + async findKanjiMetaBulk(kanjiList, dictionaries) { + return this._findGenericBulk('kanjiMeta', 'character', kanjiList, dictionaries, Database._createKanjiMeta); } async findTagForTitle(name, title) { @@ -572,13 +572,13 @@ class Database { return count > 0; } - async _findGenericBulk(tableName, indexName, indexValueList, titles, createResult) { + async _findGenericBulk(tableName, indexName, indexValueList, dictionaries, createResult) { this._validate(); const promises = []; const results = []; const processRow = (row, index) => { - if (titles.includes(row.dictionary)) { + if (dictionaries.has(row.dictionary)) { results.push(createResult(row, index)); } }; |