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

Method peekBack

data_structures/deque.ts:455–458  ·  view source on GitHub ↗

* Return the back element without removing it, or `undefined` if the deque * is empty. * * @example Peeking at the back * ```ts * import { Deque } from "@std/data-structures/deque"; * import { assertEquals } from "@std/assert"; * * const deque = new Deque([1, 2, 3]); * ass

()

Source from the content-addressed store, hash-verified

453 * @returns The back element, or `undefined` if empty.
454 */
455 peekBack(): T | undefined {
456 if (this.#length === 0) return undefined;
457 return this.#buffer[(this.#head + this.#length - 1) & this.#mask];
458 }
459
460 /**
461 * Return the element at the given index (0-based from front). Negative

Callers 1

deque_test.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected