X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fqueue.ts;h=7682f65f952136743c1f81724a26e53264ac18ed;hb=956cfeccbd168a90f3d9acb1729975cf3f861a77;hp=ab606547b1f77fb08ab6b203e0053ad182b481e6;hpb=bf4dcb92f8d370524a2975961731fe6c4e8b083c;p=poolifier.git diff --git a/src/queue.ts b/src/queue.ts index ab606547..7682f65f 100644 --- a/src/queue.ts +++ b/src/queue.ts @@ -55,4 +55,12 @@ export class Queue { } return item } + + /** + * Peek at the first item. + */ + public peek (): T | undefined { + if (this.size <= 0) return undefined + return this.items[this.head] + } }