repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
feat: switch event emission to async context friendly alternative
[poolifier.git]
/
src
/
queue.ts
diff --git
a/src/queue.ts
b/src/queue.ts
index ab606547b1f77fb08ab6b203e0053ad182b481e6..7682f65f952136743c1f81724a26e53264ac18ed 100644
(file)
--- a/
src/queue.ts
+++ b/
src/queue.ts
@@
-55,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]
+ }
}