Skip to content

Commit

Permalink
fix flag exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
DonovanDMC committed May 21, 2024
1 parent 7f06a72 commit 8f6969f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ export default class Util {
static getFlags<T extends string, N extends number | bigint>(list: Record<T, N>, flags: N, skipEnumReverseKeys = true) {
const res = {} as Record<T, boolean>;
for (const [key, value] of Object.entries(list) as Array<[T, N]>) {
if (skipEnumReverseKeys && /\d/.test(key)) {
if (skipEnumReverseKeys && !isNaN(Number(key))) {
continue;
}
res[key] = (flags & value) === value;
Expand All @@ -369,7 +369,7 @@ export default class Util {
static getFlagsArray<T extends string, N extends number | bigint>(list: Record<T, N>, flags: N, skipEnumReverseKeys = true) {
const res = [] as Array<T>;
for (const [key, value] of Object.entries(list) as Array<[T, N]>) {
if (skipEnumReverseKeys && /\d/.test(key)) {
if (skipEnumReverseKeys && !isNaN(Number(key))) {
continue;
}
if ((flags & value) === value) {
Expand Down

0 comments on commit 8f6969f

Please sign in to comment.