* Remove and return the element at the given index (0-based from front). * Negative indices count from the back (`-1` is the last element). Returns * `undefined` for out-of-range indices. The gap is closed by shifting * whichever side (front or back) has fewer elements to move. * * @e
(index: number)
| 364 | * @returns The removed element, or `undefined` if the index is out of range. |
| 365 | */ |
| 366 | removeAt(index: number): T | undefined { |
| 367 | if (index < 0) index += this.#length; |
| 368 | if (index < 0 || index >= this.#length) return undefined; |
| 369 | return this.#removeAtUnchecked(index); |
| 370 | } |
| 371 | |
| 372 | /** |
| 373 | * Return the first element matching the predicate, scanning from front to |
no test coverage detected