ReadonlycombinatorReadonlyrepositoryThe underlying read-only store that maps flag names to their bit values.
Static ReadonlyMAX_The largest bit value that can be safely used as a flag (0x40000000 = 2^30).
JavaScript bitwise operators work on 32-bit signed integers internally.
The most significant bit (bit 31) is the sign bit, so using it causes the
result to become negative. MAX_SAFE_FLAG is therefore capped at 2^30,
leaving the sign bit untouched and keeping all flag values positive.
This limits a NumberFlagRegistry to at most 31 distinct flags.
ProtectedcoerceInternalConverts a raw value or string representation into the registry's native bit type TBit.
A native bit value or its string representation.
The parsed value as TBit.
ParseError if value cannot be converted to a valid non-negative TBit.
Returns all [name, bit] pairs for registered flags in registration order.
Same as registry.repository.entries().
Returns the raw bit value assigned to the given flag name.
Same as registry.repository.get()
The registered flag name to look up.
The bit value for flagName.
UnknownFlagError if flagName is not registered.
Returns all registered flag names in registration order.
Same as registry.repository.keys().
Parses a raw bit value or string into a Flag.
String values may use numeric prefixes: "0b" for binary, "0o" for octal,
"0x" for hexadecimal, or a plain decimal string.
The bit value or string representation to parse.
A Flag whose Flag.bits equal the parsed value.
ParseError if value cannot be converted to TBit.
UnknownBitsError if the parsed value contains bits not present in any registered flag.
StaticdefineCreates a NumberFlagRegistry from an explicit name-to-bit mapping.
Use this factory when you need precise control over bit values — for example, when values must match an external protocol, a database column, or a legacy enum.
A plain object whose keys are flag names and values are the
number bit values to assign to each flag.
A new FlagRegistry typed to the given flag names and branded
with TBrand.
NotPositiveError if any value is ≤ 0.
OverflowError if any value exceeds MAX_SAFE_FLAG (2^30).
DuplicateError if two flags share the same bit value.
NotPowerOfTwoError if any value is not a power of two.
Protected StaticfindInternalFinds duplicates from the passed array.
array with flag names.
array with all duplicates.
StaticfromCreates a NumberFlagRegistry from a list of flag names, auto-assigning
consecutive powers of two as bit values.
The first name receives 2 ** 0 = 1, the second 2 ** 1 = 2,
the third 2 ** 2 = 4, and so on. Because JS bitwise operators are limited
to 32-bit signed integers, the registry supports at most 31 flags
(up to 2 ** 30 = MAX_SAFE_FLAG). For more flags use
BigIntFlagRegistry.from instead.
Flag names in registration order. Each name must be unique.
A new FlagRegistry typed to the given flag names and branded
with TBrand.
DuplicateFlagsError if any name appears more than once.
OverflowError if the number of flags exceeds 31.
Protected StatichasInternalChecks whether the passed array has duplicate values.
array with flag names.
true if the array has duplicates and false otherwise.
The bitwise combinator used internally to perform AND, OR, NOT, and other operations on values of type
TBit.