Link Search Menu Expand Document (external link)

Birb / Bitfield

Class: Bitfield<K>

Type parameters

Name Type
K extends string

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Bitfield<K>(bits, flags?)

A Bitfield stores bits as bigints.

Params

flags The flags available to the Bitfield.

Type parameters

Name Type
K extends string

Parameters

Name Type Description
bits number | bigint The bigint or number representation of the Bitfield.
flags? Object -

Defined in

src/classes/bitfields/Bitfield.ts:30

Properties

bits

bits: bigint

The bits as a bigint.

Defined in

src/classes/bitfields/Bitfield.ts:10

Methods

add

add(…flags): Bitfield<K>

Adds bits to the Bitfield.

Parameters

Name Type Description
...flags BitResolvable<K>[] The BitResolvable(s) to add.

Returns

Bitfield<K>

The updated Bitfield instance.

Defined in

src/classes/bitfields/Bitfield.ts:79


clone

Abstract clone(): Bitfield<K>

Clones the Bitfield.

Returns

Bitfield<K>

The cloned Bitfield.

Defined in

src/classes/bitfields/Bitfield.ts:22


convert

convert(flags): bigint

Converts a BitResolvable to a bigint.

Parameters

Name Type Description
flags BitResolvable<K> | BitResolvable<K>[] The BitResolvable(s) to convert.

Returns

bigint

The bigint representation of the BitResolvable(s).

Defined in

src/classes/bitfields/Bitfield.ts:43


has

has(…flags): boolean

Checks if the Bitfield has the given flag.

Parameters

Name Type Description
...flags BitResolvable<K>[] The BitResolvable(s) to check.

Returns

boolean

Whether the Bitfield has the given flag(s).

Defined in

src/classes/bitfields/Bitfield.ts:127


isEmpty

isEmpty(): boolean

Checks if the Bitfield is empty.

Returns

boolean

Whether the Bitfield is empty.

Defined in

src/classes/bitfields/Bitfield.ts:136


isLocked

isLocked(): boolean

Check if the Bitfield is locked.

Returns

boolean

Defined in

src/classes/bitfields/Bitfield.ts:178


remove

remove(…flags): Bitfield<K>

Removes bits from the Bitfield.

Parameters

Name Type Description
...flags BitResolvable<K>[] The BitResolvable(s) to remove.

Returns

Bitfield<K>

The updated Bitfield instance.

Defined in

src/classes/bitfields/Bitfield.ts:111


set

set(…flags): Bitfield<K>

Sets the contents of the Bitfield.

Parameters

Name Type Description
...flags BitResolvable<K>[] The BitResolvable(s) to set.

Returns

Bitfield<K>

The updated Bitfield instance.

Defined in

src/classes/bitfields/Bitfield.ts:95


toArray

toArray(): K[]

Converts the Bitfield to an array of strings.

Returns

K[]

The array of strings representation of the Bitfield.

Defined in

src/classes/bitfields/Bitfield.ts:154


toBigInt

toBigInt(): bigint

Converts the Bitfield to a bigint.

Returns

bigint

The bigint representation of the Bitfield.

Defined in

src/classes/bitfields/Bitfield.ts:145