/**
* Dequeue an item.
*
- * @returns The dequeued item.
- * @returns `undefined` if the queue is empty.
+ * @returns The dequeued item or `undefined` if the queue is empty.
*/
public dequeue (): T | undefined {
if (this.size <= 0) return undefined
}
return item
}
+
+ /**
+ * Peek at the first item.
+ */
+ public peek (): T | undefined {
+ if (this.size <= 0) return undefined
+ return this.items[this.head]
+ }
}