summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-04 20:14:51 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-10 14:02:43 -0500
commit7093d8f06e26daf825745be26238d92ed122e60b (patch)
treeba29fe54dd93c9fec337af9dd970d55c992ef676 /ext/bg
parent58c099799940fce56c7a57ce566c522c7eb0eb12 (diff)
Simplify how definition count is limited
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/api.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index f379e65a..c50db76f 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -75,16 +75,15 @@ async function apiOptionsSave(source) {
async function apiTermsFind(text, optionsContext) {
const options = await apiOptionsGet(optionsContext);
const [definitions, length] = await utilBackend().translator.findTerms(text, options);
- return {
- length,
- definitions: definitions.slice(0, options.general.maxResults)
- };
+ definitions.splice(options.general.maxResults);
+ return {length, definitions};
}
async function apiKanjiFind(text, optionsContext) {
const options = await apiOptionsGet(optionsContext);
const definitions = await utilBackend().translator.findKanji(text, options);
- return definitions.slice(0, options.general.maxResults);
+ definitions.splice(options.general.maxResults);
+ return definitions;
}
async function apiDefinitionAdd(definition, mode, context, optionsContext) {