* Remove and return the item at the head. O(1). * @returns {any}
()
| 57 | * @returns {any} |
| 58 | */ |
| 59 | shift() { |
| 60 | if (this.#size === 0) return undefined; |
| 61 | const item = this.#backing[this.#head]; |
| 62 | this.#backing[this.#head] = undefined; // Help GC |
| 63 | this.#head = (this.#head + 1) & this.#mask; |
| 64 | this.#size--; |
| 65 | return item; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Read item at a logical index (0 = head). O(1). |
no outgoing calls
no test coverage detected