* Removes and returns the oldest enqueued item. * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty.
()
| 45 | * @returns {T | undefined} The head of the queue of `undefined` if this queue is empty. |
| 46 | */ |
| 47 | dequeue() { |
| 48 | const result = this._set[Symbol.iterator]().next(); |
| 49 | if (result.done) return; |
| 50 | this._set.delete(result.value); |
| 51 | return result.value; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | module.exports = Queue; |
no test coverage detected