aboutsummaryrefslogtreecommitdiff
path: root/ext/js/data/options-util.js
diff options
context:
space:
mode:
authorKuuuube <61125188+Kuuuube@users.noreply.github.com>2024-02-12 01:10:52 -0500
committerGitHub <noreply@github.com>2024-02-12 06:10:52 +0000
commitfd48f18f8aa05a362f3168cbddcc03659e7510db (patch)
tree56d0eef7b54c19aae04f3a43bdcdf5a2d4409733 /ext/js/data/options-util.js
parent92f6652ade62264cbdd600ec44c7581ec8e23b08 (diff)
Add and fix tests with options upgrades (#671)24.2.12.0
* Add and fix tests and options applying * Fix comma * Add test file to json.json * Fix direction of conjugation handlebars update * Add frequency and cloze-body-kana to upgrade * Use Array.isArray() instead of arbitrary length check * Add pitch-accent-categories handlebar * programmatically get upgrade files * add type --------- Co-authored-by: Cashew <tungbinem@gmail.com>
Diffstat (limited to 'ext/js/data/options-util.js')
-rw-r--r--ext/js/data/options-util.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js
index 2ecd5527..312c6efc 100644
--- a/ext/js/data/options-util.js
+++ b/ext/js/data/options-util.js
@@ -1115,8 +1115,10 @@ export class OptionsUtil {
*/
_updateVersion23(options) {
for (const {options: profileOptions} of options.profiles) {
- for (const dictionary of profileOptions.dictionaries) {
- dictionary.partsOfSpeechFilter = true;
+ if (Array.isArray(profileOptions.dictionaries)) {
+ for (const dictionary of profileOptions.dictionaries) {
+ dictionary.partsOfSpeechFilter = true;
+ }
}
}
}
@@ -1129,8 +1131,10 @@ export class OptionsUtil {
await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v24.handlebars');
for (const {options: profileOptions} of options.profiles) {
- for (const dictionary of profileOptions.dictionaries) {
- dictionary.useDeinflections = true;
+ if (Array.isArray(profileOptions.dictionaries)) {
+ for (const dictionary of profileOptions.dictionaries) {
+ dictionary.useDeinflections = true;
+ }
}
}
}