Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(BitField): throw an error if bit to resolve is undefined #5565

Merged
merged 9 commits into from
Jun 9, 2021
2 changes: 0 additions & 2 deletions src/util/BitField.js
Original file line number Diff line number Diff line change
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