bitwise-flag - v2.1.0
    Preparing search index...

    Interface FlagRegistry<TFlags, TBit, TBrand>

    interface FlagRegistry<
        TFlags extends string,
        TBit extends Bit,
        TBrand extends string | symbol = symbol,
    > {
        combinator: Combinator<TBit>;
        fullBits: TBit;
        repository: Repository<TFlags, TBit>;
        combine(...flags: TFlags[]): Flag<TFlags, TBit, TBrand>;
        empty(): Flag<TFlags, TBit, TBrand>;
        entries(): [TFlags, TBit][];
        full(): Flag<TFlags, TBit, TBrand>;
        get(flagName: TFlags): TBit;
        keys(): TFlags[];
        of(...flags: TFlags[]): Flag<TFlags, TBit, TBrand>;
        parse(value: string | TBit, radix: unknown): Flag<TFlags, TBit, TBrand>;
        parse(value: string | TBit): Flag<TFlags, TBit, TBrand>;
        values(): TBit[];
    }

    Type Parameters

    • TFlags extends string
    • TBit extends Bit
    • TBrand extends string | symbol = symbol
    Index

    Properties

    combinator: Combinator<TBit>

    The bitwise combinator used internally to perform AND, OR, NOT, and other operations on values of type TBit.

    fullBits: TBit

    A bitmask with every registered flag set — the bitwise OR of all flag values.

    // For a registry with READ=1, WRITE=2, EXEC=4:
    registry.fullBits; // 7
    repository: Repository<TFlags, TBit>

    The underlying read-only store that maps flag names to their bit values.

    Methods

    • Returns all [name, bit] pairs for registered flags in registration order. Same as registry.repository.entries().

      Returns [TFlags, TBit][]

      registry.entries(); // [["READ", 1], ["WRITE", 2], ["EXEC", 4]]