diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-08-11 14:59:02 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-02 20:25:30 -0400 |
commit | fc4a9614123732688cad643117abf2a047593b43 (patch) | |
tree | 7d0c8aac295ad833918822412d7d359eb2be7714 /ext/bg/js/translator.js | |
parent | 4ac55da7dd5354e6c3495f04583352d0d863b7b6 (diff) |
Replace some instances of Array.concat
.push or .unshift can accomplish the same operation without constructing new arrays.
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r-- | ext/bg/js/translator.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index c6af1f4e..e9e388f3 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -186,7 +186,7 @@ class Translator { let deinflections = await this.findTermDeinflections(text, titles, cache); const textHiragana = jpKatakanaToHiragana(text); if (text !== textHiragana) { - deinflections = deinflections.concat(await this.findTermDeinflections(textHiragana, titles, cache)); + deinflections.push(...await this.findTermDeinflections(textHiragana, titles, cache)); } let definitions = []; @@ -235,7 +235,7 @@ class Translator { let deinflections = []; for (let i = text.length; i > 0; --i) { const textSlice = text.slice(0, i); - deinflections = deinflections.concat(await this.deinflector.deinflect(textSlice, definer)); + deinflections.push(...await this.deinflector.deinflect(textSlice, definer)); } return deinflections; @@ -247,7 +247,7 @@ class Translator { const titles = Object.keys(dictionaries); for (const c of text) { if (!processed[c]) { - definitions = definitions.concat(await this.database.findKanji(c, titles)); + definitions.push(...await this.database.findKanji(c, titles)); processed[c] = true; } } @@ -277,7 +277,7 @@ class Translator { async buildTermFrequencies(definition, titles) { let terms = []; if (definition.expressions) { - terms = terms.concat(definition.expressions); + terms.push(...definition.expressions); } else { terms.push(definition); } |