Use isObject

This commit is contained in:
toasted-nutbread 2020-04-17 19:25:07 -04:00
parent ebfc7ca945
commit 018913d03f

View File

@ -112,11 +112,7 @@ class AnkiConnect {
async _invoke(action, params) { async _invoke(action, params) {
const result = await requestJson(this._server, 'POST', {action, params, version: this._localVersion}); const result = await requestJson(this._server, 'POST', {action, params, version: this._localVersion});
if ( if (isObject(result)) {
result !== null &&
typeof result === 'object' &&
!Array.isArray(result)
) {
const error = result.error; const error = result.error;
if (typeof error !== 'undefined') { if (typeof error !== 'undefined') {
throw new Error(`AnkiConnect error: ${error}`); throw new Error(`AnkiConnect error: ${error}`);