0

My .NET backend handle enum authorization with HasFlag()

Enum Foo {
  0: Zero,
  1: One,
  2: Two,
  3: Three,
  ..
}

5.HasEnum(Foo.One) is falsy because 5 is equal to 3 + 2
6.HasEnum(Foo.One) is truthy because 6 is equal to 3 + 2 + 1

How to handle it in JavaScript ?

I'm receiving a rôle (that is > 0 and < 1048), how to know if it has 32 rôle ?

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
Delbo ar
  • 362
  • 2
  • 4
  • 12

0 Answers0