Skip to content

Commit 90ab935

Browse files
committed
Fix Node.js 12 compatibility
Fixes #7
1 parent 812e5ed commit 90ab935

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ export default class Queue {
4747
}
4848

4949
peek() {
50-
return this.#head?.value;
50+
if (!this.#head) {
51+
return;
52+
}
53+
54+
return this.#head.value;
55+
56+
// TODO: Node.js 18.
57+
// return this.#head?.value;
5158
}
5259

5360
clear() {

0 commit comments

Comments
 (0)