X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fqueue.ts;h=7682f65f952136743c1f81724a26e53264ac18ed;hb=d77575028a825f2c63b9aaf7515b0dc58663c378;hp=ab606547b1f77fb08ab6b203e0053ad182b481e6;hpb=557991e8ddb66a72a47d62606e142e8be86677f2;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] + } }