mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
src: Replace instanceof Array checks with Array.isArray and instanceof Buffer with Buffer.isBuffer (#3227)
* src: Replace instanceof Array checks with Array.isArray * src: Buffer.isBuffer instead of instanceof Buffer
This commit is contained in:
@@ -33,7 +33,7 @@ class GuildEmojiRoleStore extends Collection {
|
||||
*/
|
||||
add(roleOrRoles) {
|
||||
if (roleOrRoles instanceof Collection) return this.add(roleOrRoles.keyArray());
|
||||
if (!(roleOrRoles instanceof Array)) return this.add([roleOrRoles]);
|
||||
if (!Array.isArray(roleOrRoles)) return this.add([roleOrRoles]);
|
||||
roleOrRoles = roleOrRoles.map(r => this.guild.roles.resolve(r));
|
||||
|
||||
if (roleOrRoles.includes(null)) {
|
||||
@@ -52,7 +52,7 @@ class GuildEmojiRoleStore extends Collection {
|
||||
*/
|
||||
remove(roleOrRoles) {
|
||||
if (roleOrRoles instanceof Collection) return this.remove(roleOrRoles.keyArray());
|
||||
if (!(roleOrRoles instanceof Array)) return this.remove([roleOrRoles]);
|
||||
if (!Array.isArray(roleOrRoles)) return this.remove([roleOrRoles]);
|
||||
roleOrRoles = roleOrRoles.map(r => this.guild.roles.resolveID(r));
|
||||
|
||||
if (roleOrRoles.includes(null)) {
|
||||
|
||||
@@ -65,7 +65,7 @@ class GuildMemberRoleStore extends Collection {
|
||||
* @returns {Promise<GuildMember>}
|
||||
*/
|
||||
async add(roleOrRoles, reason) {
|
||||
if (roleOrRoles instanceof Collection || roleOrRoles instanceof Array) {
|
||||
if (roleOrRoles instanceof Collection || Array.isArray(roleOrRoles)) {
|
||||
roleOrRoles = roleOrRoles.map(r => this.guild.roles.resolve(r));
|
||||
if (roleOrRoles.includes(null)) {
|
||||
throw new TypeError('INVALID_TYPE', 'roles',
|
||||
@@ -96,7 +96,7 @@ class GuildMemberRoleStore extends Collection {
|
||||
* @returns {Promise<GuildMember>}
|
||||
*/
|
||||
async remove(roleOrRoles, reason) {
|
||||
if (roleOrRoles instanceof Collection || roleOrRoles instanceof Array) {
|
||||
if (roleOrRoles instanceof Collection || Array.isArray(roleOrRoles)) {
|
||||
roleOrRoles = roleOrRoles.map(r => this.guild.roles.resolve(r));
|
||||
if (roleOrRoles.includes(null)) {
|
||||
throw new TypeError('INVALID_TYPE', 'roles',
|
||||
|
||||
Reference in New Issue
Block a user