aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-22 11:30:24 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-22 14:43:06 -0500
commit54bb702b843ae9a312704f27e282bf340e8197fc (patch)
treec08c2177779156f6e90dfb237cbb2eb95a94302a /ext/bg/js
parentf143632f28d3bc2f89144958ff49e9e0b1932c96 (diff)
Updates for PR feedback
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/dictionary.js10
-rw-r--r--ext/bg/js/translator.js2
2 files changed, 6 insertions, 6 deletions
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js
index bffa7afa..f5c5b21b 100644
--- a/ext/bg/js/dictionary.js
+++ b/ext/bg/js/dictionary.js
@@ -49,8 +49,8 @@ function dictTermsSort(definitions, dictionaries=null) {
if (dictionaries !== null) {
const dictionaryInfo1 = dictionaries.get(v1.dictionary);
const dictionaryInfo2 = dictionaries.get(v2.dictionary);
- const priority1 = typeof dictionaryInfo1 !== 'undefined' ? dictionaryInfo1.priority || 0 : 0;
- const priority2 = typeof dictionaryInfo2 !== 'undefined' ? dictionaryInfo2.priority || 0 : 0;
+ const priority1 = typeof dictionaryInfo1 !== 'undefined' ? dictionaryInfo1.priority : 0;
+ const priority2 = typeof dictionaryInfo2 !== 'undefined' ? dictionaryInfo2.priority : 0;
i = priority2 - priority1;
if (i !== 0) { return i; }
}
@@ -254,7 +254,7 @@ function dictTermsMergeByGloss(result, definitions, appendTo=null, mergedIndices
if (appendTo === null) {
/*
Data layout:
- result.expressions = new Map([
+ resultExpressionsMap = new Map([
[expression, new Map([
[reading, new Map([
[tagName, tagInfo],
@@ -289,17 +289,17 @@ function dictTermsMergeByGloss(result, definitions, appendTo=null, mergedIndices
const only = [];
const expressionSet = definition.expression;
const readingSet = definition.reading;
- definition.only = only;
if (!dictAreSetsEqual(expressionSet, resultExpressionSet)) {
only.push(...dictGetSetIntersection(expressionSet, resultExpressionSet));
}
if (!dictAreSetsEqual(readingSet, resultReadingSet)) {
only.push(...dictGetSetIntersection(readingSet, resultReadingSet));
}
+ definition.only = only;
}
return definitionsByGloss;
- }
+}
function dictTagBuildSource(name) {
return dictTagSanitize({name, category: 'dictionary', order: 100});
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index 6cf07d93..a675a9f7 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -71,7 +71,7 @@ class Translator {
}
async getMergedSecondarySearchResults(text, expressionsMap, secondarySearchDictionaries) {
- if (secondarySearchDictionaries.length === 0) {
+ if (secondarySearchDictionaries.size === 0) {
return [];
}