From 688f8c9a01c2a58864360db7f8b559813d0c66b5 Mon Sep 17 00:00:00 2001 From: Vaporox Date: Wed, 16 Dec 2020 16:09:41 +0100 Subject: [PATCH] fix(Collection): toJSON() errors if the collection includes empty values --- src/util/Collection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/Collection.js b/src/util/Collection.js index 3219fb8a63d8..259244f15e19 100644 --- a/src/util/Collection.js +++ b/src/util/Collection.js @@ -5,7 +5,7 @@ const Util = require('./Util'); class Collection extends BaseCollection { toJSON() { - return this.map(e => (typeof e.toJSON === 'function' ? e.toJSON() : Util.flatten(e))); + return this.map(e => (typeof e?.toJSON === 'function' ? e.toJSON() : Util.flatten(e))); } }