MCPcopy Index your code
hub / github.com/nodejs/node / shift

Method shift

lib/internal/streams/iter/ringbuffer.js:59–66  ·  view source on GitHub ↗

* Remove and return the item at the head. O(1). * @returns {any}

()

Source from the content-addressed store, hash-verified

57 * @returns {any}
58 */
59 shift() {
60 if (this.#size === 0) return undefined;
61 const item = this.#backing[this.#head];
62 this.#backing[this.#head] = undefined; // Help GC
63 this.#head = (this.#head + 1) & this.#mask;
64 this.#size--;
65 return item;
66 }
67
68 /**
69 * Read item at a logical index (0 = head). O(1).

Callers 15

tickMethod · 0.45
resetMethod · 0.45
constructorMethod · 0.45
onAbortMethod · 0.45
nextMethod · 0.45
finishImplFunction · 0.45
#actualWriteBufferMethod · 0.45
#actualWriteUtf8Method · 0.45
#flushBufferSyncMethod · 0.45
#flushSyncUtf8Method · 0.45
mapFunction · 0.45
#waitForBufferSpaceMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected