mirror of
https://github.com/danbulant/discord.js
synced 2026-06-09 01:31:29 +00:00
fix(BitField): throw when resolving invalid string constant
Checked to see if the permission actually exists.
This commit is contained in:
parent
ea8b4e7355
commit
41c0dd44eb
1 changed files with 1 additions and 1 deletions
|
|
@ -146,7 +146,7 @@ class BitField {
|
||||||
if (typeof bit === 'number' && bit >= 0) return bit;
|
if (typeof bit === 'number' && bit >= 0) return bit;
|
||||||
if (bit instanceof BitField) return bit.bitfield;
|
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 (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');
|
throw new RangeError('BITFIELD_INVALID');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue