summaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-05-05 20:06:13 -0700
committerAlex Yatskov <alex@foosoft.net>2016-05-05 20:06:13 -0700
commit9cb099e5f6aad33c70d986bd6a48668e54ee211c (patch)
treed46de3d97388764f15f8f319d8455e60d3c2d9f4 /ext/bg/js/translator.js
parentdd4b2f73656d652bc56be784a27e7378ab969ac6 (diff)
Optimization
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 606f6ec5..1a7b9bb4 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -89,12 +89,12 @@ class Translator {
}
}
- let results = [];
+ let definitions = [];
for (const key in groups) {
- results.push(groups[key]);
+ definitions.push(groups[key]);
}
- results = results.sort((v1, v2) => {
+ definitions = definitions.sort((v1, v2) => {
const sl1 = v1.source.length;
const sl2 = v2.source.length;
if (sl1 > sl2) {
@@ -123,25 +123,25 @@ class Translator {
});
let length = 0;
- for (const result of results) {
+ for (const result of definitions) {
length = Math.max(length, result.source.length);
}
- return {results: results, length: length};
+ return {definitions: definitions, length: length};
}
findKanji(text) {
- let results = [];
+ let definitions = [];
const processed = {};
for (const c of text) {
if (!processed[c]) {
- results = results.concat(this.dictionary.findKanji(c));
+ definitions = definitions.concat(this.dictionary.findKanji(c));
processed[c] = true;
}
}
- return results;
+ return definitions;
}
processTerm(groups, source, tags, rules=[], root='') {