Incremunica
    Preparing search index...

    A simple queue implementation.

    Type Parameters

    • T
    Index

    Constructors

    Accessors

    Methods

    Constructors

    • Creates a new queue.

      Type Parameters

      • T

      Parameters

      • OptionalinitialValues: T[]

        Optional initial values to add to the queue.

      Returns Queue<T>

    Accessors

    • get length(): number

      Returns the length of the queue.

      Returns number

      The length of the queue.

    Methods

    • Returns an iterator for the queue, without removing elements.

      Returns Generator<T>

    • Clears the queue.

      Returns void

    • Drains the queue, returning all values and emptying the queue.

      Returns Generator<T>

    • Returns the value at the start of the queue without removing it.

      Returns undefined | T

      The value at the start of the queue or undefined if the queue is empty.

    • Adds a value to the end of the queue.

      Parameters

      • value: T

        The value to push.

      Returns void

    • Removes a value from the start of the queue.

      Returns undefined | T

      The removed value or undefined if the queue is empty.