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) {
|
async function apiTermsFind(text, optionsContext) {
|
||||||
const options = await apiOptionsGet(optionsContext);
|
const options = await apiOptionsGet(optionsContext);
|
||||||
const [definitions, length] = await utilBackend().translator.findTerms(text, options);
|
const [definitions, length] = await utilBackend().translator.findTerms(text, options);
|
||||||
return {
|
definitions.splice(options.general.maxResults);
|
||||||
length,
|
return {length, definitions};
|
||||||
definitions: definitions.slice(0, options.general.maxResults)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function apiKanjiFind(text, optionsContext) {
|
async function apiKanjiFind(text, optionsContext) {
|
||||||
const options = await apiOptionsGet(optionsContext);
|
const options = await apiOptionsGet(optionsContext);
|
||||||
const definitions = await utilBackend().translator.findKanji(text, options);
|
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) {
|
async function apiDefinitionAdd(definition, mode, context, optionsContext) {
|
||||||
|
Loading…
Reference in New Issue
Block a user