Deviopath › TypeScript

Permission Bit Flags

Medium · Enums

Each Permission is a power of two, so several permissions can be combined into one number with | (for example Read | Write is 3). Check a flag with (flags & Permission.Write) !== 0.

Write listPermissions(flags: number): string[] that returns the names of all permissions contained in flags, from the smallest value to the largest. Numeric enums have a reverse mapping: Permission[1] is "Read".

Next: Parse a Query String