Skip to content

Commit e1fe0b8

Browse files
committed
Use condition shorthand for return in getFirstMentionedUser()
- Use condition shorthand syntax for return statements in function getFirstMentionedUser() - Fixed logic error for collection length checking, collection length is never negative - Bumped version to v2.3.0-beta1
1 parent 47e48a6 commit e1fe0b8

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,10 +892,7 @@ function getFirstMentionedUser(message) {
892892
throw new TypeError("Incorrect type for getFirstMentionedUser argument!");
893893
}
894894
const mentionsCollection = message.mentions.members;
895-
if (mentionsCollection.length <= 0) {
896-
return;
897-
}
898-
return mentionsCollection.first();
895+
return mentionsCollection.length === 0 ? undefined : mentionsCollection.first();
899896
}
900897

901898
function isInteger(string, acceptSign) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chillbot",
3-
"version": "2.3.0-alpha1",
3+
"version": "2.3.0-beta1",
44
"description": "Chill!",
55
"keywords": [
66
"discord",

0 commit comments

Comments
 (0)