aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/backend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-25 21:26:56 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-25 22:13:03 -0500
commit7b97138ad1242ab51206f5d35247da3a9ccd905d (patch)
treef9c379067c7e2b8c96529d5cc50d4e6728580d88 /ext/bg/js/backend.js
parent6bd714fec0437413d0731e0d346f52f8abe55cd2 (diff)
Changed type returned by apiTextParseMecab to avoid using for in
Diffstat (limited to 'ext/bg/js/backend.js')
-rw-r--r--ext/bg/js/backend.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 3051a873..717ffac3 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -357,11 +357,11 @@ class Backend {
async _onApiTextParseMecab({text, optionsContext}) {
const options = await this.getOptions(optionsContext);
- const results = {};
+ const results = [];
const rawResults = await this.mecab.parseText(text);
- for (const mecabName in rawResults) {
+ for (const [mecabName, parsedLines] of Object.entries(rawResults)) {
const result = [];
- for (const parsedLine of rawResults[mecabName]) {
+ for (const parsedLine of parsedLines) {
for (const {expression, reading, source} of parsedLine) {
const term = [];
if (expression !== null && reading !== null) {
@@ -381,7 +381,7 @@ class Backend {
}
result.push([{text: '\n'}]);
}
- results[mecabName] = result;
+ results.push([mecabName, result]);
}
return results;
}