summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/dictionary.js27
1 files changed, 8 insertions, 19 deletions
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js
index 5a85bb5b..532d17c7 100644
--- a/ext/bg/js/dictionary.js
+++ b/ext/bg/js/dictionary.js
@@ -178,26 +178,15 @@ function dictTermsMergeBySequence(definitions, mainDictionary) {
function dictTermsMergeByGloss(result, definitions, appendTo=null, mergedIndices=null) {
const definitionsByGloss = appendTo !== null ? appendTo : new Map();
for (const [index, definition] of definitions.entries()) {
- if (appendTo !== null) {
- let match = false;
- for (const expression of result.expressions.keys()) {
- if (definition.expression === expression) {
- for (const reading of result.expressions.get(expression).keys()) {
- if (definition.reading === reading) {
- match = true;
- break;
- }
- }
- }
- if (match) {
- break;
- }
- }
-
- if (!match) {
- continue;
- } else if (mergedIndices !== null) {
+ if (mergedIndices !== null) {
+ const expressionMap = result.expressions.get(definition.expression);
+ if (
+ typeof expressionMap !== 'undefined' &&
+ typeof expressionMap.get(definition.reading) !== 'undefined'
+ ) {
mergedIndices.add(index);
+ } else {
+ continue;
}
}