fix: re-add highest property to RoleStore and GuildMemberRoleStore

closes #2302
This commit is contained in:
Lewdcario 2018-03-01 11:52:29 -06:00
parent 2a9fdef9e5
commit 9b41a6a8a6
No known key found for this signature in database
GPG key ID: F9A141E5527C6660
2 changed files with 10 additions and 1 deletions

View file

@ -106,7 +106,7 @@ class GuildMemberRoleStore extends DataStore {
* @readonly
*/
get highest() {
return this.reduce((prev, role) => !prev || role.comparePositionTo(prev) > 0 ? role : prev);
return this.reduce((prev, role) => role.comparePositionTo(prev) > 0 ? role : prev, this.first());
}
/**

View file

@ -55,6 +55,15 @@ class RoleStore extends DataStore {
});
}
/**
* The role with the highest position in the store
* @type {Role}
* @readonly
*/
get highest() {
return this.reduce((prev, role) => role.comparePositionTo(prev) > 0 ? role : prev, this.first());
}
/**
* Data that can be resolved to a Role object. This can be:
* * A Role