Skip to content

Bitfield

Kind: global class

Constructs a new instance of the class.

ParamTypeDefaultDescription
[bit]numberthis.constructor.defaultBitThe bit value to initialize the instance with.

Checks if any of the given bit(s) are set in the bitfield.

Kind: instance method of Bitfield
Returns: boolean - True if any of the given bit(s) are set, false otherwise.

ParamTypeDescription
…bitbigintThe bit(s) to check.

Checks if the given bit(s) are set in the bitfield.

Kind: instance method of Bitfield
Returns: boolean - True if the bit(s) are set, false otherwise.

ParamTypeDescription
…bitbigintThe bit(s) to check.

Adds one or more bit(s) to the current bitfield.

Kind: instance method of Bitfield
Returns: this - The modified instance of the class.

ParamTypeDescription
…bitbigintThe bit(s) to add.

Removes one or more bits from the bitfield.

Kind: instance method of Bitfield
Returns: Bitfield - A new Bitfield object with the specified bits removed.

ParamTypeDescription
…bitsbigintThe bits to remove from the bitfield.

Converts the flags of an object into an array of keys.

Kind: instance method of Bitfield
Returns: Array - An array of keys representing the flags that are set in the object.

Returns a string representation of the bitfield.

Kind: instance method of Bitfield
Returns: string - - The string representation of the bitfield.

Serializes the current object into a JSON object.

Kind: instance method of Bitfield
Returns: Object - - The serialized object.

Freezes the current object, making it immutable.

Kind: instance method of Bitfield
Returns: None

An empty object representing a set of flags for a bitfield.

Kind: static property of Bitfield

Sets the default bit value for the Bitfield class.

Kind: static property of Bitfield

ParamTypeDescription
defaultBitbigintThe default bit value to set.

Resolves a bit value based on the given input.

Kind: static method of Bitfield
Returns: number | bigint - - The resolved bit value.
Throws:

  • BitfieldInvalid - If the specified bitfield is invalid or not found.
ParamTypeDescription
bitanyThe bit value to resolve.