mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
fix(Collection): toJSON() errors if the collection includes empty values (#5129)
This commit is contained in:
@@ -5,7 +5,7 @@ const Util = require('./Util');
|
|||||||
|
|
||||||
class Collection extends BaseCollection {
|
class Collection extends BaseCollection {
|
||||||
toJSON() {
|
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user