Update dictEnabledSet and dictConfigured to use for of
This commit is contained in:
parent
b391704f3d
commit
0b5a26e64a
@ -20,22 +20,16 @@
|
|||||||
|
|
||||||
function dictEnabledSet(options) {
|
function dictEnabledSet(options) {
|
||||||
const enabledDictionaryMap = new Map();
|
const enabledDictionaryMap = new Map();
|
||||||
const optionsDictionaries = options.dictionaries;
|
for (const [title, {enabled, priority, allowSecondarySearches}] of Object.entries(options.dictionaries)) {
|
||||||
for (const title in optionsDictionaries) {
|
if (!enabled) { continue; }
|
||||||
if (!hasOwn(optionsDictionaries, title)) { continue; }
|
enabledDictionaryMap.set(title, {priority, allowSecondarySearches});
|
||||||
const dictionary = optionsDictionaries[title];
|
|
||||||
if (!dictionary.enabled) { continue; }
|
|
||||||
enabledDictionaryMap.set(title, {
|
|
||||||
priority: dictionary.priority || 0,
|
|
||||||
allowSecondarySearches: !!dictionary.allowSecondarySearches
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return enabledDictionaryMap;
|
return enabledDictionaryMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
function dictConfigured(options) {
|
function dictConfigured(options) {
|
||||||
for (const title in options.dictionaries) {
|
for (const {enabled} of Object.values(options.dictionaries)) {
|
||||||
if (options.dictionaries[title].enabled) {
|
if (enabled) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user