UNPKG

sussy-util

Version:
38 lines (37 loc) 1.12 kB
import { Optional } from '.'; export default class Queue<T> { private items; constructor(initElm: T[]); /** * The function takes a variable number of arguments of type T and pushes them into the items array * @param {any[]} elm - T[] */ push(...elm: T[]): void; /** * It returns the first element of the array * @returns The first item in the array. */ peek(): Optional<T>; /** * It removes the first element from an array and returns that element * @returns The first element of the array. */ shift(): Optional<T>; /** * Returns true if the queue is empty, false otherwise * @returns The method returns a boolean value. */ empty(): boolean; toString(): string; /** * This function returns a copy of the items array. * @returns The clone of the items array. */ toArray(): T[]; /** * It takes the items array and converts it to a JSON string. * @returns The JSON string representation of the items array. */ toJSONString(): string; [Symbol.iterator](): Iterator<T>; }