From 9751c4b8dbbe55394eb0ff8f64fe54e149e000fd Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 3 May 2018 12:06:01 -0400 Subject: [PATCH] reworked logic in user.blocks.filter --- src/user/blocks.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/user/blocks.js b/src/user/blocks.js index 5834fdd0b4..e0477a2cc4 100644 --- a/src/user/blocks.js +++ b/src/user/blocks.js @@ -76,7 +76,10 @@ module.exports = function (User) { property = 'uid'; } - if (!set || !Array.isArray(set) || !set.length || !(set[0].hasOwnProperty(property) || typeof set[0] === 'number' || typeof set[0] === 'string')) { + if (!Array.isArray(set) || !set.length || !set.every((item) => { + const check = item.hasOwnProperty(property) ? item[property] : item; + return item && ['number', 'string'].includes(typeof check); + })) { return callback(null, set); }