fix(BitField): throw when resolving invalid string constant

Checked to see if the permission actually exists.
This commit is contained in:
Jiralite
2019-10-01 09:46:49 +01:00
committed by SpaceEEC
parent ea8b4e7355
commit 41c0dd44eb

View File

@@ -146,7 +146,7 @@ class BitField {
if (typeof bit === 'number' && bit >= 0) 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, 0);
if (typeof bit === 'string') return this.FLAGS[bit];
if (typeof bit === 'string' && typeof this.FLAGS[bit] !== 'undefined') return this.FLAGS[bit];
throw new RangeError('BITFIELD_INVALID');
}
}