summary refs log tree commit diff
path: root/dist/server-util/src/util/BitField.d.ts
blob: 1b08c1f886f88c6296d44193a2af7e1eb59f3833 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
export declare type BitFieldResolvable = number | BigInt | BitField | string | BitFieldResolvable[];
/**
 * Data structure that makes it easy to interact with a bitfield.
 */
export declare class BitField {
    bitfield: bigint;
    static FLAGS: Record<string, bigint>;
    constructor(bits?: BitFieldResolvable);
    /**
     * Checks whether the bitfield has a bit, or any of multiple bits.
     */
    any(bit: BitFieldResolvable): boolean;
    /**
     * Checks if this bitfield equals another
     */
    equals(bit: BitFieldResolvable): boolean;
    /**
     * Checks whether the bitfield has a bit, or multiple bits.
     */
    has(bit: BitFieldResolvable): boolean;
    /**
     * Gets all given bits that are missing from the bitfield.
     */
    missing(bits: BitFieldResolvable): BitFieldResolvable[];
    /**
     * Freezes these bits, making them immutable.
     */
    freeze(): Readonly<BitField>;
    /**
     * Adds bits to these ones.
     * @param {...BitFieldResolvable} [bits] Bits to add
     * @returns {BitField} These bits or new BitField if the instance is frozen.
     */
    add(...bits: BitFieldResolvable[]): BitField;
    /**
     * Removes bits from these.
     * @param {...BitFieldResolvable} [bits] Bits to remove
     */
    remove(...bits: BitFieldResolvable[]): BitField;
    /**
     * Gets an object mapping field names to a {@link boolean} indicating whether the
     * bit is available.
     * @param {...*} hasParams Additional parameters for the has method, if any
     */
    serialize(): Record<string, boolean>;
    /**
     * Gets an {@link Array} of bitfield names based on the bits available.
     */
    toArray(): string[];
    toJSON(): bigint;
    valueOf(): bigint;
    [Symbol.iterator](): Generator<string, void, undefined>;
    /**
     * Data that can be resolved to give a bitfield. This can be:
     * * A bit number (this can be a number literal or a value taken from {@link BitField.FLAGS})
     * * An instance of BitField
     * * An Array of BitFieldResolvable
     * @typedef {number|BitField|BitFieldResolvable[]} BitFieldResolvable
     */
    /**
     * Resolves bitfields to their numeric form.
     * @param {BitFieldResolvable} [bit=0] - bit(s) to resolve
     * @returns {number}
     */
    static resolve(bit?: BitFieldResolvable): bigint;
}