mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
fix: remove for..in in favor of Object.keys (#3745)
This commit is contained in:
@@ -238,7 +238,7 @@ class RESTMethods {
|
|||||||
include_nsfw: options.nsfw,
|
include_nsfw: options.nsfw,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const key in options) if (options[key] === undefined) delete options[key];
|
for (const key of Object.keys(options)) if (options[key] === undefined) delete options[key];
|
||||||
const queryString = (querystring.stringify(options).match(/[^=&?]+=[^=&?]+/g) || []).join('&');
|
const queryString = (querystring.stringify(options).match(/[^=&?]+=[^=&?]+/g) || []).join('&');
|
||||||
|
|
||||||
let endpoint;
|
let endpoint;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class SecretKey {
|
|||||||
* @type {Uint8Array}
|
* @type {Uint8Array}
|
||||||
*/
|
*/
|
||||||
this.key = new Uint8Array(new ArrayBuffer(key.length));
|
this.key = new Uint8Array(new ArrayBuffer(key.length));
|
||||||
for (const index in key) this.key[index] = key[index];
|
for (const index of Object.keys(key)) this.key[index] = key[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class ReadyHandler extends AbstractHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.notes) {
|
if (data.notes) {
|
||||||
for (const user in data.notes) {
|
for (const user of Object.keys(data.notes)) {
|
||||||
let note = data.notes[user];
|
let note = data.notes[user];
|
||||||
if (!note.length) note = null;
|
if (!note.length) note = null;
|
||||||
|
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ class GuildChannel extends Channel {
|
|||||||
payload.deny = prevOverwrite.deny;
|
payload.deny = prevOverwrite.deny;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const perm in options) {
|
for (const perm of Object.keys(options)) {
|
||||||
if (options[perm] === true) {
|
if (options[perm] === true) {
|
||||||
payload.allow |= Permissions.FLAGS[perm] || 0;
|
payload.allow |= Permissions.FLAGS[perm] || 0;
|
||||||
payload.deny &= ~(Permissions.FLAGS[perm] || 0);
|
payload.deny &= ~(Permissions.FLAGS[perm] || 0);
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ class Permissions {
|
|||||||
*/
|
*/
|
||||||
serialize(checkAdmin = true) {
|
serialize(checkAdmin = true) {
|
||||||
const serialized = {};
|
const serialized = {};
|
||||||
for (const perm in this.constructor.FLAGS) serialized[perm] = this.has(perm, checkAdmin);
|
for (const perm of Object.keys(this.constructor.FLAGS)) serialized[perm] = this.has(perm, checkAdmin);
|
||||||
return serialized;
|
return serialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user