feat(Permissions): add new method Permissions#any (#3450)

* Add new method Permissions#any

* Update src/util/BitField.js

This is much better

Co-Authored-By: bdistin <bdistin@gmail.com>

* Remove unreachable code

* Gotta keep the linter happy

* Apply bdistin suggested change to both methods
This commit is contained in:
Ryan Munro
2019-09-10 18:55:42 +10:00
committed by SpaceEEC
parent 4fc461c2f9
commit a6810e2eaa
3 changed files with 22 additions and 2 deletions

View File

@@ -17,6 +17,15 @@ class BitField {
this.bitfield = this.constructor.resolve(bits);
}
/**
* Checks whether the bitfield has a bit, or any of multiple bits.
* @param {BitFieldResolvable} bit Bit(s) to check for
* @returns {boolean}
*/
any(bit) {
return (this.bitfield & this.constructor.resolve(bit)) !== 0;
}
/**
* Checks if this bitfield equals another
* @param {BitFieldResolvable} bit Bit(s) to check for