UNPKG

es-next-tools

Version:

A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.

48 lines (47 loc) 1.54 kB
/** * Represents a double-ended queue (deque) data structure. * @template T The type of elements in the deque. */ export declare class Deque<T> { private items; /** * Adds an item to the front of the deque. * @param {T} item - The item to add to the front. */ addFront(item: T): void; /** * Adds an item to the back of the deque. * @param {T} item - The item to add to the back. */ addBack(item: T): void; /** * Removes and returns the item from the front of the deque. * @returns {T | undefined} The item removed from the front, or undefined if empty. */ removeFront(): T | undefined; /** * Removes and returns the item from the back of the deque. * @returns {T | undefined} The item removed from the back, or undefined if empty. */ removeBack(): T | undefined; /** * Returns the item at the front of the deque without removing it. * @returns {T | undefined} The item at the front, or undefined if empty. */ peekFront(): T | undefined; /** * Returns the item at the back of the deque without removing it. * @returns {T | undefined} The item at the back, or undefined if empty. */ peekBack(): T | undefined; /** * Checks if the deque is empty. * @returns {boolean} True if the deque is empty, false otherwise. */ isEmpty(): boolean; /** * Returns the number of items in the deque. * @returns {number} The size of the deque. */ size(): number; }