Skip to main content

Class: BitField<Flags>

bitfield/src.BitField

Type parameters

NameType
Flagsextends Record<string, number> | Record<string, bigint>

Constructors

constructor

new BitField<Flags>(flags)

Type parameters

NameType
Flagsextends Record<string, number> | Record<string, bigint>

Parameters

NameType
flagsReadonly<Flags>

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:7

Properties

flags

Readonly flags: Flags

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:5


mask

Readonly mask: PrimitiveType<Flags[keyof Flags]>

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:4


type

Readonly type: Flags[keyof Flags] extends number ? "number" : "bigint"

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:2


zero

Readonly zero: Flags[keyof Flags] extends number ? 0 : 0n

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:3

Methods

any

any(field, bits): boolean

Parameters

NameTypeDescription
fieldMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>
bitsMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>

Returns

boolean

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:81


complement

complement(field): PrimitiveType<Flags[keyof Flags]>

Parameters

NameTypeDescription
fieldMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>

Returns

PrimitiveType<Flags[keyof Flags]>

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:114


difference

difference(a, b): PrimitiveType<Flags[keyof Flags]>

Parameters

NameTypeDescription
aMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>
bMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>

Returns

PrimitiveType<Flags[keyof Flags]>

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:183


has

has(field, bits): boolean

Parameters

NameTypeDescription
fieldMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>
bitsMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>

Returns

boolean

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:91


intersection

intersection(bitfield, ...fields): PrimitiveType<Flags[keyof Flags]>

Parameters

NameTypeDescription
bitfieldMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>
...fieldsreadonly MaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>[]

Returns

PrimitiveType<Flags[keyof Flags]>

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:159


resolve

resolve(resolvable): PrimitiveType<Flags[keyof Flags]>

Parameters

NameTypeDescription
resolvableMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>

Returns

PrimitiveType<Flags[keyof Flags]>

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:60


symmetricDifference

symmetricDifference(a, b): PrimitiveType<Flags[keyof Flags]>

Parameters

NameTypeDescription
aMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>
bMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>

Returns

PrimitiveType<Flags[keyof Flags]>

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:205


toArray

toArray(field): keyof Flags[]

Parameters

NameTypeDescription
fieldMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>

Returns

keyof Flags[]

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:226


toObject

toObject(field): Record<keyof Flags, boolean>

Parameters

NameTypeDescription
fieldMaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>

Returns

Record<keyof Flags, boolean>

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:260


union

union(...fields): PrimitiveType<Flags[keyof Flags]>

Parameters

NameTypeDescription
...fieldsreadonly MaybeArray<keyof Flags | PrimitiveType<Flags[keyof Flags]>>[]

Returns

PrimitiveType<Flags[keyof Flags]>

Defined in

projects/utilities/packages/bitfield/src/lib/BitField.ts:132