summaryrefslogtreecommitdiff
path: root/ext/js/data
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/data')
-rw-r--r--ext/js/data/anki-util.js4
-rw-r--r--ext/js/data/options-util.js7
2 files changed, 6 insertions, 5 deletions
diff --git a/ext/js/data/anki-util.js b/ext/js/data/anki-util.js
index 123e5d2f..eea3fb8b 100644
--- a/ext/js/data/anki-util.js
+++ b/ext/js/data/anki-util.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {isObject} from '../core/utilities.js';
+import {isObjectNotArray} from '../core/object-utilities.js';
/** @type {RegExp} @readonly */
const markerPattern = /\{([\w-]+)\}/g;
@@ -74,7 +74,7 @@ export function cloneFieldMarkerPattern(global) {
* @returns {boolean} `true` if the note is valid, `false` otherwise.
*/
export function isNoteDataValid(note) {
- if (!isObject(note)) { return false; }
+ if (!isObjectNotArray(note)) { return false; }
const {fields, deckName, modelName} = note;
return (
typeof deckName === 'string' &&
diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js
index de30f52a..f2d085fe 100644
--- a/ext/js/data/options-util.js
+++ b/ext/js/data/options-util.js
@@ -18,7 +18,8 @@
import {fetchJson, fetchText} from '../core/fetch-utilities.js';
import {parseJson} from '../core/json.js';
-import {escapeRegExp, isObject} from '../core/utilities.js';
+import {isObjectNotArray} from '../core/object-utilities.js';
+import {escapeRegExp} from '../core/utilities.js';
import {TemplatePatcher} from '../templates/template-patcher.js';
import {JsonSchema} from './json-schema.js';
@@ -70,7 +71,7 @@ export class OptionsUtil {
// Remove invalid profiles
const profiles = /** @type {unknown[]} */ (options.profiles);
for (let i = profiles.length - 1; i >= 0; --i) {
- if (!isObject(profiles[i])) {
+ if (!isObjectNotArray(profiles[i])) {
profiles.splice(i, 1);
}
}
@@ -1102,7 +1103,7 @@ export class OptionsUtil {
}
}
- if (customTemplates && isObject(chrome.storage)) {
+ if (customTemplates && isObjectNotArray(chrome.storage)) {
void chrome.storage.session.set({needsCustomTemplatesWarning: true});
await this._createTab(chrome.runtime.getURL('/welcome.html'));
void chrome.storage.session.set({openedWelcomePage: true});