MCPcopy Create free account
hub / github.com/denoland/std / removeAt

Method removeAt

data_structures/deque.ts:366–370  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 1

deque_test.tsFile · 0.80

Calls 1

#removeAtUncheckedMethod · 0.95

Tested by

no test coverage detected