Interface BitFlagValue<TValues>

Represents either a bitflag enum member or a union of bitflag enum members

Type Parameters

  • TValues extends readonly string[]

Hierarchy

Properties

hasFlag: ((other) => boolean)

Type declaration

    • (other): boolean
    • Example

      const union = Color.Red.or(Color.Blue);
      union.hasFlag(Color.Red) // true
      union.hasFlag(Color.Blue) // true
      union.hasFlag(Color.Green) // false

      Parameters

      Returns boolean

      true if other is present in this, false otherwise

intersect: ((others) => BitFlagValue<TValues>)

Type declaration

    • (others): BitFlagValue<TValues>
    • Creates a new BitFlagValue representing the intersection of the operands

      Example

      const union = Color.Red.or(Color.Blue).intersect([Color.Red, Color.Green]);
      union.hasFlag(Color.Red) // true
      union.hasFlag(Color.Blue) // false
      union.hasFlag(Color.Green) // false

      Parameters

      Returns BitFlagValue<TValues>

or: ((other) => BitFlagValue<TValues>)

Type declaration

    • (other): BitFlagValue<TValues>
    • Creates a new BitFlagValue representing the union of the operands

      Example

      const union = Color.Red.or(Color.Blue);
      union.hasFlag(Color.Red) // true
      union.hasFlag(Color.Blue) // true
      union.hasFlag(Color.Green) // false

      Parameters

      Returns BitFlagValue<TValues>

union: ((others) => BitFlagValue<TValues>)

Type declaration

    • (others): BitFlagValue<TValues>
    • Creates a new BitFlagValue representing the union of the operands

      Example

      const union = Color.Red.union([Color.Blue, Color.Green]);
      union.hasFlag(Color.Red) // true
      union.hasFlag(Color.Blue) // true
      union.hasFlag(Color.Green) // true
      union.hasFlag(Color.Purple) // false

      Parameters

      Returns BitFlagValue<TValues>

value: number

The backing bitflag value

Generated using TypeDoc