diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-02-22 15:22:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-22 15:22:42 -0500 |
commit | 897f2360be13db70ff2f533089ba8d38b0b744ed (patch) | |
tree | fdfdc9ed13fb38117e922d27c60616f159a2c63e /ext/bg/js/backend.js | |
parent | f8f03f3af0ab031cc58bf5ad3f782c8d45137430 (diff) | |
parent | 6513a15b3b5fd8586226c8823e2680478b97e132 (diff) |
Merge pull request #363 from toasted-nutbread/eslint-stylistic-rules
Eslint stylistic rules
Diffstat (limited to 'ext/bg/js/backend.js')
-rw-r--r-- | ext/bg/js/backend.js | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 16dffc85..2691b7d9 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -274,18 +274,18 @@ class Backend { const node = nodes.pop(); for (const key of Object.keys(node.obj)) { const path = node.path.concat(key); - const obj = node.obj[key]; - if (obj !== null && typeof obj === 'object') { - nodes.unshift({obj, path}); + const obj2 = node.obj[key]; + if (obj2 !== null && typeof obj2 === 'object') { + nodes.unshift({obj: obj2, path}); } else { - valuePaths.push([obj, path]); + valuePaths.push([obj2, path]); } } } return valuePaths; } - function modifyOption(path, value, options) { + function modifyOption(path, value) { let pivot = options; for (const key of path.slice(0, -1)) { if (!hasOwn(pivot, key)) { @@ -298,7 +298,7 @@ class Backend { } for (const [value, path] of getValuePaths(changedOptions)) { - modifyOption(path, value, options); + modifyOption(path, value); } await this._onApiOptionsSave({source}); @@ -340,9 +340,9 @@ class Backend { dictTermsSort(definitions); const {expression, reading} = definitions[0]; const source = text.substring(0, sourceLength); - for (const {text, furigana} of jpDistributeFuriganaInflected(expression, reading, source)) { - const reading = jpConvertReading(text, furigana, options.parsing.readingMode); - term.push({text, reading}); + for (const {text: text2, furigana} of jpDistributeFuriganaInflected(expression, reading, source)) { + const reading2 = jpConvertReading(text2, furigana, options.parsing.readingMode); + term.push({text: text2, reading: reading2}); } text = text.substring(source.length); } else { @@ -365,17 +365,17 @@ class Backend { for (const {expression, reading, source} of parsedLine) { const term = []; if (expression !== null && reading !== null) { - for (const {text, furigana} of jpDistributeFuriganaInflected( + for (const {text: text2, furigana} of jpDistributeFuriganaInflected( expression, jpKatakanaToHiragana(reading), source )) { - const reading = jpConvertReading(text, furigana, options.parsing.readingMode); - term.push({text, reading}); + const reading2 = jpConvertReading(text2, furigana, options.parsing.readingMode); + term.push({text: text2, reading: reading2}); } } else { - const reading = jpConvertReading(source, null, options.parsing.readingMode); - term.push({text: source, reading}); + const reading2 = jpConvertReading(source, null, options.parsing.readingMode); + term.push({text: source, reading: reading2}); } result.push(term); } @@ -801,8 +801,11 @@ class Backend { await new Promise((resolve, reject) => { chrome.tabs.update(tab.id, {active: true}, () => { const e = chrome.runtime.lastError; - if (e) { reject(e); } - else { resolve(); } + if (e) { + reject(e); + } else { + resolve(); + } }); }); @@ -813,18 +816,24 @@ class Backend { try { const tabWindow = await new Promise((resolve, reject) => { - chrome.windows.get(tab.windowId, {}, (tabWindow) => { + chrome.windows.get(tab.windowId, {}, (value) => { const e = chrome.runtime.lastError; - if (e) { reject(e); } - else { resolve(tabWindow); } + if (e) { + reject(e); + } else { + resolve(value); + } }); }); if (!tabWindow.focused) { await new Promise((resolve, reject) => { chrome.windows.update(tab.windowId, {focused: true}, () => { const e = chrome.runtime.lastError; - if (e) { reject(e); } - else { resolve(); } + if (e) { + reject(e); + } else { + resolve(); + } }); }); } |