From 0cd4041c6b60d984a1c5dc96564859be58a18a16 Mon Sep 17 00:00:00 2001 From: jamescqcampbell <18332640+jamescqcampbell@users.noreply.github.com> Date: Sun, 13 Jun 2021 17:22:14 +0100 Subject: [PATCH] Address sqlite findAll bug When used with sqlite Model.findAll returns an Array of instances that is not recognised by Keychain as an Array in line 51 (as typeof record returns 'object') and the hook throws a TypeError. Switching to Array.isArray(record) solves the issue. --- sequelize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sequelize.js b/sequelize.js index 16749d4..11e853c 100644 --- a/sequelize.js +++ b/sequelize.js @@ -48,7 +48,7 @@ function beforeSave(record, options) { function afterFind(record) { if (!record) { return; - } else if (record instanceof Array) { + } else if (Array.isArray(record)) { return record.map(afterFind); }