From bc6b5d2653bf126bfe93d337fc24e05010e15fbf Mon Sep 17 00:00:00 2001 From: Sebastian Baumhekel Date: Wed, 16 Jan 2019 14:33:54 +0100 Subject: [PATCH] use Array.isArray() function to check for arrays. this ensures correct array detection also for iframes (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray) --- www/SQLitePlugin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/www/SQLitePlugin.js b/www/SQLitePlugin.js index c8145a87d..5a8bf2967 100644 --- a/www/SQLitePlugin.js +++ b/www/SQLitePlugin.js @@ -264,13 +264,13 @@ SQLitePlugin.prototype.sqlBatch = function(sqlStatements, success, error) { var batchList, j, len1, myfn, st; - if (!sqlStatements || sqlStatements.constructor !== Array) { + if (!Array.isArray(sqlStatements)) { throw newSQLError('sqlBatch expects an array'); } batchList = []; for (j = 0, len1 = sqlStatements.length; j < len1; j++) { st = sqlStatements[j]; - if (st.constructor === Array) { + if (Array.isArray(st)) { if (st.length === 0) { throw newSQLError('sqlBatch array element of zero (0) length'); } @@ -360,7 +360,7 @@ var j, len1, params, sqlStatement, t, v; sqlStatement = typeof sql === 'string' ? sql : sql.toString(); params = []; - if (!!values && values.constructor === Array) { + if (Array.isArray(values)) { for (j = 0, len1 = values.length; j < len1; j++) { v = values[j]; t = typeof v;