Simplify how definition count is limited
This commit is contained in:
parent
58c0997999
commit
7093d8f06e
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user