@ac-essentials/misc-util
    Preparing search index...

    Interface IDeque<T>

    Interface representing a double-ended queue (deque) data type.

    A deque is a generalized version of a queue that allows insertion and removal of items from both ends.

    interface IDeque<T = unknown> {
        capacity: number;
        "[asyncIterator]"(): AsyncIterator<T, any, any>;
        "[iterator]"(): Iterator<Promisable<T>, any, any>;
        back(): Promisable<undefined | T>;
        clear(): Promisable<void>;
        concat(...items: T[]): MaybeAsyncIterableIterator<T>;
        count(): Promisable<number>;
        front(): Promisable<undefined | T>;
        pop(): Promisable<undefined | T>;
        push(...items: T[]): Promisable<void>;
        remove(
            condition: Predicate<[T]>,
        ): Promisable<MaybeAsyncIterableIterator<T>>;
        removeFirst(condition: Predicate<[T]>): Promisable<boolean>;
        replace(
            condition: Predicate<[T]>,
            newItemFactory: Callable<[T], T>,
        ): Promisable<MaybeAsyncIterableIterator<T>>;
        replaceFirst(condition: Predicate<[T]>, newItem: T): Promisable<boolean>;
        shift(): Promisable<undefined | T>;
        unshift(...items: T[]): Promisable<void>;
        waitPush(
            items: Iterable<T>,
            signal?: null | AbortSignal,
        ): PromiseLike<void>;
        waitUnshift(
            items: Iterable<T>,
            signal?: null | AbortSignal,
        ): PromiseLike<void>;
    }

    Type Parameters

    • T = unknown

      The type of elements in the deque.

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    capacity: number

    The maximum number of elements the collection can hold. If the collection is unbounded, this will be Infinity.

    Methods

    • Returns AsyncIterator<T, any, any>

    • Returns Iterator<Promisable<T>, any, any>

    • Adds one or more items to the back of the deque.

      The items are added in the order they are provided, with the last item in the argument list becoming the new back of the deque.

      Parameters

      • ...items: T[]

        The items to add to the back of the deque.

      Returns Promisable<void>

      If the operation would exceed the deque's capacity.

    • Adds one or more items to the front of the deque.

      The items are added in the order they are provided, with the last item in the argument list becoming the new front of the deque.

      Parameters

      • ...items: T[]

        The items to add to the front of the deque.

      Returns Promisable<void>

      If the operation would exceed the deque's capacity.

    • Same as push, but waits for capacity if the operation would exceed it.

      Parameters

      • items: Iterable<T>
      • Optionalsignal: null | AbortSignal

        Optional abort signal to cancel the operation.

      Returns PromiseLike<void>

      IDeque.push

    • Same as unshift, but waits for capacity if the operation would exceed it.

      Parameters

      • items: Iterable<T>
      • Optionalsignal: null | AbortSignal

        Optional abort signal to cancel the operation.

      Returns PromiseLike<void>

      IDeque.unshift