Skip to content

Commit

Permalink
fix(BitField): throw an error if bit to resolve is undefined (#5565)
Browse files Browse the repository at this point in the history
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
  • Loading branch information
kevinbioj and vladfrangu committed Jun 9, 2021
1 parent 0139e10 commit 0156f69
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/util/BitField.js
Expand Up @@ -41,7 +41,6 @@ class BitField {
* @returns {boolean}
*/
has(bit) {
if (Array.isArray(bit)) return bit.every(p => this.has(p));
bit = this.constructor.resolve(bit);
return (this.bitfield & bit) === bit;
}
Expand Down Expand Up @@ -143,7 +142,6 @@ class BitField {
*/
static resolve(bit) {
const { defaultBit } = this;
if (typeof bit === 'undefined') return defaultBit;
if (typeof defaultBit === typeof bit && bit >= defaultBit) return bit;
if (bit instanceof BitField) return bit.bitfield;
if (Array.isArray(bit)) return bit.map(p => this.resolve(p)).reduce((prev, p) => prev | p, defaultBit);
Expand Down

0 comments on commit 0156f69

Please sign in to comment.