UNPKG

@zvenigora/ng-eval-core

Version:

An expression evaluator for Angular

34 lines (33 loc) 1.02 kB
import { QueueType } from '../../interfaces'; /** * Represents a generic queue data structure. * @template T The type of elements stored in the queue. */ export declare class Queue<T> implements QueueType<T> { private readonly _queue; /** * Creates a new instance of the Queue class. * @param _queue Optional initial array of elements. */ constructor(_queue?: T[]); /** * Gets the number of elements in the queue. */ get length(): number; /** * Removes and returns the first element in the queue. * @returns The first element in the queue, or undefined if the queue is empty. */ dequeue(): T | undefined; /** * Adds an element to the end of the queue. * @param value The element to add to the queue. * @returns The new length of the queue. */ enqueue(value: T): number; /** * Returns the first element in the queue without removing it. * @returns The first element in the queue. */ peek(): T; }