diff --git a/src/client/ClientDataResolver.js b/src/client/ClientDataResolver.js index bac611258..04ff7aeb6 100644 --- a/src/client/ClientDataResolver.js +++ b/src/client/ClientDataResolver.js @@ -10,10 +10,6 @@ const Guild = getStructure('Guild'); const Channel = getStructure('Channel'); const GuildMember = getStructure('GuildMember'); -function $string(obj) { - return (typeof obj === 'string' || obj instanceof String); -} - /** * The DataResolver identifies different objects and tries to resolve a specific piece of information from them, e.g. * extracting a User from a Message object. @@ -31,7 +27,7 @@ class ClientDataResolver { * * A Message (resolves to the message author) * * A Guild (owner of the guild) * * A Guild Member - * @typedef {User|String|Message|Guild|GuildMember} UserResolvable + * @typedef {User|string|Message|Guild|GuildMember} UserResolvable */ /** @@ -42,7 +38,7 @@ class ClientDataResolver { resolveUser(user) { if (user instanceof User) { return user; - } else if ($string(user)) { + } else if (typeof user === 'string') { return this.client.users.get(user); } else if (user instanceof Message) { return user.author; @@ -105,7 +101,7 @@ class ClientDataResolver { /** * Data that resolves to give a Base64 string, typically for image uploading. This can be: * * A Buffer - * * A Base64 String + * * A Base64 string * @typedef {Buffer|string} Base64Resolvable */ @@ -139,7 +135,7 @@ class ClientDataResolver { return channel; } - if ($string(channel)) { + if (typeof channel === 'string') { return this.client.channels.get(channel.id); } @@ -147,20 +143,20 @@ class ClientDataResolver { } /** - * Data that can be resolved to give a String. This can be: - * * A String + * Data that can be resolved to give a string. This can be: + * * A string * * An Array (joined with a new line delimiter to give a string) * * Any object * @typedef {string|Array|Object} StringResolvable */ /** - * Resolves a StringResolvable to a String + * Resolves a StringResolvable to a string * @param {StringResolvable} StringResolvable the string resolvable to resolve * @returns {string} */ resolveString(data) { - if (data instanceof String) { + if (typeof data === 'string') { return data; } @@ -185,7 +181,7 @@ class ClientDataResolver { * @returns {string|Buffer} */ resolveFile(resource) { - if ($string(resource)) { + if (typeof resource === 'string') { return new Promise((resolve, reject) => { if (/^https?:\/\//.test(resource)) { request.get(resource) diff --git a/src/client/rest/RESTMethods.js b/src/client/rest/RESTMethods.js index cf0cb32a2..68736fc12 100644 --- a/src/client/rest/RESTMethods.js +++ b/src/client/rest/RESTMethods.js @@ -464,7 +464,7 @@ class RESTMethods { if (_data.permissions) { let perms = 0; for (let perm of _data.permissions) { - if (perm instanceof String || typeof perm === 'string') { + if (typeof perm === 'string') { perm = Constants.PermissionFlags[perm]; } perms |= perm; diff --git a/src/structures/DMChannel.js b/src/structures/DMChannel.js index c71d603f0..8cf633f2a 100644 --- a/src/structures/DMChannel.js +++ b/src/structures/DMChannel.js @@ -31,7 +31,7 @@ class DMChannel extends Channel { } /** - * When concatenated with a String, this automatically concatenates the recipient's mention instead of the + * When concatenated with a string, this automatically concatenates the recipient's mention instead of the * DM channel object. * @returns {string} */ diff --git a/src/structures/Emoji.js b/src/structures/Emoji.js index 9e8d97c7c..6a9660749 100644 --- a/src/structures/Emoji.js +++ b/src/structures/Emoji.js @@ -68,7 +68,7 @@ class Emoji { } /** - * When concatenated with a String, this automatically returns the emoji mention rather than the object. + * When concatenated with a string, this automatically returns the emoji mention rather than the object. * @returns {string} * @example * // send an emoji: diff --git a/src/structures/EvaluatedPermissions.js b/src/structures/EvaluatedPermissions.js index 7a71d4fd0..bcb9ac385 100644 --- a/src/structures/EvaluatedPermissions.js +++ b/src/structures/EvaluatedPermissions.js @@ -39,7 +39,7 @@ class EvaluatedPermissions { * @returns {boolean} */ hasPermission(permission, explicit = false) { - if (permission instanceof String || typeof permission === 'string') { + if (typeof permission === 'string') { permission = Constants.PermissionFlags[permission]; } diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 7dff83dbb..458539ffd 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -151,7 +151,7 @@ class Guild { } /** - * When concatenated with a String, this automatically concatenates the Guild's name instead of the Guild object. + * When concatenated with a string, this automatically concatenates the Guild's name instead of the Guild object. * @returns {string} * @example * // logs: Hello from My Guild! diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index d5bb55fd8..c10cade55 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -263,7 +263,7 @@ class GuildChannel extends Channel { } /** - * When concatenated with a String, this automatically returns the Channel's mention instead of the Channel object. + * When concatenated with a string, this automatically returns the Channel's mention instead of the Channel object. * @returns {string} * @example * // Outputs: Hello from #general diff --git a/src/structures/Role.js b/src/structures/Role.js index 472ff1322..f8407e8b2 100644 --- a/src/structures/Role.js +++ b/src/structures/Role.js @@ -198,7 +198,7 @@ class Role { * } */ hasPermission(permission, explicit = false) { - if (permission instanceof String || typeof permission === 'string') { + if (typeof permission === 'string') { permission = Constants.PermissionFlags[permission]; } @@ -216,7 +216,7 @@ class Role { } /** - * When concatenated with a String, this automatically concatenates the Role mention rather than the Role object. + * When concatenated with a string, this automatically concatenates the Role mention rather than the Role object. * @returns {string} */ toString() { diff --git a/src/structures/User.js b/src/structures/User.js index 769d5350b..34a09cb54 100644 --- a/src/structures/User.js +++ b/src/structures/User.js @@ -56,7 +56,7 @@ class User { } /** - * When concatenated with a String, this automatically concatenates the User's mention instead of the User object. + * When concatenated with a string, this automatically concatenates the User's mention instead of the User object. * @returns {string} * @example * // logs: Hello from <@123456789>! diff --git a/src/structures/interface/TextBasedChannel.js b/src/structures/interface/TextBasedChannel.js index 211a8742a..755b0ef76 100644 --- a/src/structures/interface/TextBasedChannel.js +++ b/src/structures/interface/TextBasedChannel.js @@ -196,7 +196,7 @@ class TextBasedChannel { */ sendFile(attachment, fileName) { if (!fileName) { - if (attachment instanceof String || typeof attachment === 'string') { + if (typeof attachment === 'string') { fileName = path.basename(attachment); } else if (attachment && attachment.path) { fileName = path.basename(attachment.path);