fix(Collection): toJSON() errors if the collection includes empty values (#5129)

This commit is contained in:
Jan
2020-12-26 10:56:37 +01:00
committed by GitHub
parent b19b8b593a
commit 2c2249ee73

View File

@@ -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)));
}
}