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

Method peekFront

data_structures/deque.ts:434–437  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

432 * @returns The front element, or `undefined` if empty.
433 */
434 peekFront(): T | undefined {
435 if (this.#length === 0) return undefined;
436 return this.#buffer[this.#head];
437 }
438
439 /**
440 * Return the back element without removing it, or `undefined` if the deque

Callers 2

onAbortMethod · 0.80
deque_test.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected