* Remove `count` items from the head without returning them. * O(count) for GC cleanup.
(count)
| 80 | * O(count) for GC cleanup. |
| 81 | */ |
| 82 | trimFront(count) { |
| 83 | if (count <= 0) return; |
| 84 | if (count >= this.#size) { |
| 85 | this.clear(); |
| 86 | return; |
| 87 | } |
| 88 | for (let i = 0; i < count; i++) { |
| 89 | this.#backing[(this.#head + i) & this.#mask] = undefined; |
| 90 | } |
| 91 | this.#head = (this.#head + count) & this.#mask; |
| 92 | this.#size -= count; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Find the logical index of `item` (reference equality). O(n). |
no test coverage detected