summaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r--ext/bg/js/translator.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index dfec54ac..d32f8c67 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -48,14 +48,14 @@ class Translator {
}
async getSequencedDefinitions(definitions, mainDictionary) {
- const definitionsBySequence = dictTermsMergeBySequence(definitions, mainDictionary);
- const defaultDefinitions = definitionsBySequence['-1'];
-
- const sequenceList = Object.keys(definitionsBySequence).map((v) => Number(v)).filter((v) => v >= 0);
- const sequencedDefinitions = sequenceList.map((key) => ({
- definitions: definitionsBySequence[key],
- rawDefinitions: []
- }));
+ const [definitionsBySequence, defaultDefinitions] = dictTermsMergeBySequence(definitions, mainDictionary);
+
+ const sequenceList = [];
+ const sequencedDefinitions = [];
+ for (const [key, value] of definitionsBySequence.entries()) {
+ sequenceList.push(key);
+ sequencedDefinitions.push({definitions: value, rawDefinitions: []});
+ }
for (const definition of await this.database.findTermsBySequenceBulk(sequenceList, mainDictionary)) {
sequencedDefinitions[definition.index].rawDefinitions.push(definition);