From 0af5e7a38f8124021d0079615d7fbfc478d82ee7 Mon Sep 17 00:00:00 2001 From: Danial Raza Date: Wed, 20 Sep 2023 22:30:16 +0000 Subject: [PATCH] refactor: change remaining parameter names --- packages/discord.js/src/structures/ApplicationCommand.js | 4 ++-- packages/discord.js/src/util/Util.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/discord.js/src/structures/ApplicationCommand.js b/packages/discord.js/src/structures/ApplicationCommand.js index bd87281c1..dabb08895 100644 --- a/packages/discord.js/src/structures/ApplicationCommand.js +++ b/packages/discord.js/src/structures/ApplicationCommand.js @@ -123,7 +123,7 @@ class ApplicationCommand extends Base { * The options of this command * @type {ApplicationCommandOption[]} */ - this.options = data.options.map(o => this.constructor.transformOption(o, true)); + this.options = data.options.map(opt => this.constructor.transformOption(opt, true)); } else { this.options ??= []; } @@ -577,7 +577,7 @@ class ApplicationCommand extends Base { [nameLocalizationsKey]: choice.nameLocalizations ?? choice.name_localizations, value: choice.value, })), - options: option.options?.map(o => this.transformOption(o, received)), + options: option.options?.map(opt => this.transformOption(opt, received)), [channelTypesKey]: option.channelTypes ?? option.channel_types, [minValueKey]: option.minValue ?? option.min_value, [maxValueKey]: option.maxValue ?? option.max_value, diff --git a/packages/discord.js/src/util/Util.js b/packages/discord.js/src/util/Util.js index 5814af103..e49c43b4a 100644 --- a/packages/discord.js/src/util/Util.js +++ b/packages/discord.js/src/util/Util.js @@ -18,8 +18,8 @@ function flatten(obj, ...props) { if (!isObject(obj)) return obj; const objProps = Object.keys(obj) - .filter(k => !k.startsWith('_')) - .map(k => ({ [k]: true })); + .filter(key => !key.startsWith('_')) + .map(key => ({ [key]: true })); props = objProps.length ? Object.assign(...objProps, ...props) : Object.assign({}, ...props); @@ -39,7 +39,7 @@ function flatten(obj, ...props) { // If the valueOf is a Collection, use its array of keys else if (valueOf instanceof Collection) out[newProp] = Array.from(valueOf.keys()); // If it's an array, call toJSON function on each element if present, otherwise flatten each element - else if (Array.isArray(element)) out[newProp] = element.map(e => e.toJSON?.() ?? flatten(e)); + else if (Array.isArray(element)) out[newProp] = element.map(elm => elm.toJSON?.() ?? flatten(elm)); // If it's an object with a primitive `valueOf`, use that value else if (typeof valueOf !== 'object') out[newProp] = valueOf; // If it's an object with a toJSON function, use the return value of it