summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-03-13 11:42:04 -0500
committerGitHub <noreply@github.com>2021-03-13 11:42:04 -0500
commite1477adeecef7a3316222bd265dd6809bcafd478 (patch)
treeb58a6c2c6c81dbfa9988d4631ef6f8815d1cefce /ext
parenta00ed41838da08f5f81813443c0471a1d6be1291 (diff)
Simplify _findFirstBulk (#1521)
Diffstat (limited to 'ext')
-rw-r--r--ext/js/language/dictionary-database.js10
1 files changed, 3 insertions, 7 deletions
diff --git a/ext/js/language/dictionary-database.js b/ext/js/language/dictionary-database.js
index 40f5362b..b1c1a3aa 100644
--- a/ext/js/language/dictionary-database.js
+++ b/ext/js/language/dictionary-database.js
@@ -296,7 +296,7 @@ class DictionaryDatabase {
findTagMetaBulk(items) {
const predicate = (row, item) => (row.dictionary === item.dictionary);
- return this._findFirstBulk('tagMeta', 'name', items, predicate, this._createTagMeta.bind(this));
+ return this._findFirstBulk('tagMeta', 'name', items, predicate);
}
findTagForTitle(name, title) {
@@ -442,7 +442,7 @@ class DictionaryDatabase {
});
}
- _findFirstBulk(objectStoreName, indexName, items, predicate, createResult) {
+ _findFirstBulk(objectStoreName, indexName, items, predicate) {
return new Promise((resolve, reject) => {
const count = items.length;
const results = new Array(count);
@@ -462,7 +462,7 @@ class DictionaryDatabase {
const query = IDBKeyRange.only(item.query);
const onFind = (row) => {
- results[itemIndex] = createResult(row, itemIndex);
+ results[itemIndex] = row;
if (++completeCount >= count) {
resolve(results);
}
@@ -501,10 +501,6 @@ class DictionaryDatabase {
};
}
- _createTagMeta(row, index) {
- return {row, index};
- }
-
_createTermMeta({expression, mode, data, dictionary}, index) {
return {expression, mode, data, dictionary, index};
}