aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/api.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2017-10-01 04:17:02 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2017-10-01 04:17:02 +0300
commit803ccc1661384ee484298f3495585d3923495dd4 (patch)
tree77b4311d85ff57d5f8c2fcadecb9a2e883d90025 /ext/bg/js/api.js
parentb24c70523479c16eca848f5aafaa887549689ac6 (diff)
merged: first draft, only supports JMdict
Diffstat (limited to 'ext/bg/js/api.js')
-rw-r--r--ext/bg/js/api.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index 01322357..de3ad64e 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -29,9 +29,11 @@ async function apiTermsFind(text) {
const options = utilBackend().options;
const translator = utilBackend().translator;
- const searcher = (options.general.resultOutputMode === 'merge') && translator.findTermsMerged.bind(translator)
- || (options.general.resultOutputMode === 'split') && translator.findTermsSplit.bind(translator)
- || (options.general.resultOutputMode === 'group') && translator.findTermsGrouped.bind(translator);
+ const searcher = {
+ 'merge': translator.findTermsMerged,
+ 'split': translator.findTermsSplit,
+ 'group': translator.findTermsGrouped
+ }[options.general.resultOutputMode].bind(translator);
const {definitions, length} = await searcher(
text,