fix: fix build
[poolifier.git] / src / queue.ts
index a2a613814e86dcd5ab13b7122d8c26a7e647d610..7682f65f952136743c1f81724a26e53264ac18ed 100644 (file)
@@ -41,8 +41,7 @@ export class Queue<T> {
   /**
    * 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
@@ -56,4 +55,12 @@ export class Queue<T> {
     }
     return item
   }
+
+  /**
+   * Peek at the first item.
+   */
+  public peek (): T | undefined {
+    if (this.size <= 0) return undefined
+    return this.items[this.head]
+  }
 }