perf: use logical assignments instead of if statements (#6693)

This commit is contained in:
Almeida
2021-10-03 13:59:57 +01:00
committed by GitHub
parent 9eb9591473
commit e9daa31eaf
9 changed files with 17 additions and 21 deletions

View File

@@ -248,7 +248,7 @@ class GuildMemberManager extends CachedManager {
_data.channel_id = null;
_data.channel = undefined;
}
if (_data.roles) _data.roles = _data.roles.map(role => (role instanceof Role ? role.id : role));
_data.roles &&= _data.roles.map(role => (role instanceof Role ? role.id : role));
let endpoint = this.client.api.guilds(this.guild.id);
if (id === this.client.user.id) {
const keys = Object.keys(_data);