diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-05-05 20:06:13 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-05-05 20:06:13 -0700 |
commit | 9cb099e5f6aad33c70d986bd6a48668e54ee211c (patch) | |
tree | d46de3d97388764f15f8f319d8455e60d3c2d9f4 /ext/bg/js/translator.js | |
parent | dd4b2f73656d652bc56be784a27e7378ab969ac6 (diff) |
Optimization
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r-- | ext/bg/js/translator.js | 16 |
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='') { |