Class BitField<S, N>Abstract

Data structure that makes it easy to interact with a bitfield.

Type Parameters

  • S extends string
  • N extends bigint | number

Hierarchy (view full)

Constructors

  • Type Parameters

    • S extends string
    • N extends number | bigint

    Parameters

    Returns BitField<S, N>

Properties

bitField: N

Bitfield of the packed bits

constructor: BitFieldConstructor<S, N>
DefaultBit: number | bigint
Flags: EnumLike<unknown, number | bigint>

Numeric bitfield flags. Defined in extension classes

Methods

  • Returns Generator<S, void, unknown>

  • Adds bits to these ones.

    Parameters

    Returns this

    These bits or new BitField if the instance is frozen.

  • Checks whether the bitfield has a bit, or any of multiple bits.

    Parameters

    Returns boolean

  • Checks if this bitfield equals another

    Parameters

    Returns boolean

  • Freezes these bits, making them immutable.

    Returns Readonly<BitField<S, N>>

  • Checks whether the bitfield has a bit, or multiple bits.

    Parameters

    Returns boolean

  • Gets all given bits that are missing from the bitfield.

    Parameters

    Returns S[]

  • Removes bits from these.

    Parameters

    Returns this

    These bits or new BitField if the instance is frozen.

  • Gets an object mapping field names to a boolean indicating whether the bit is available.

    Returns Record<S, boolean>

  • Replace the bits with these.

    Parameters

    Returns this

    These bits or new BitField if the instance is frozen.

  • Gets an Array of bitfield names based on the bits available.

    Returns S[]

  • Returns string | N & number

  • Returns N

  • Resolves bitfields to their numeric form.

    Type Parameters

    • S extends string
    • N extends number | bigint

    Parameters

    Returns N