From 2c2249ee7314401b65be677c233370657e1d4695 Mon Sep 17 00:00:00 2001 From: Jan <66554238+Vaporox@users.noreply.github.com> Date: Sat, 26 Dec 2020 10:56:37 +0100 Subject: [PATCH] fix(Collection): toJSON() errors if the collection includes empty values (#5129) --- 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 3219fb8a6..259244f15 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))); } }