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