Simplify update of mergedIndices
This commit is contained in:
parent
89af73b61b
commit
50a171bc75
@ -178,26 +178,15 @@ function dictTermsMergeBySequence(definitions, mainDictionary) {
|
|||||||
function dictTermsMergeByGloss(result, definitions, appendTo=null, mergedIndices=null) {
|
function dictTermsMergeByGloss(result, definitions, appendTo=null, mergedIndices=null) {
|
||||||
const definitionsByGloss = appendTo !== null ? appendTo : new Map();
|
const definitionsByGloss = appendTo !== null ? appendTo : new Map();
|
||||||
for (const [index, definition] of definitions.entries()) {
|
for (const [index, definition] of definitions.entries()) {
|
||||||
if (appendTo !== null) {
|
if (mergedIndices !== null) {
|
||||||
let match = false;
|
const expressionMap = result.expressions.get(definition.expression);
|
||||||
for (const expression of result.expressions.keys()) {
|
if (
|
||||||
if (definition.expression === expression) {
|
typeof expressionMap !== 'undefined' &&
|
||||||
for (const reading of result.expressions.get(expression).keys()) {
|
typeof expressionMap.get(definition.reading) !== 'undefined'
|
||||||
if (definition.reading === reading) {
|
) {
|
||||||
match = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (match) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
continue;
|
|
||||||
} else if (mergedIndices !== null) {
|
|
||||||
mergedIndices.add(index);
|
mergedIndices.add(index);
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user