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

Method unshift

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

* Prepend an item to the head. O(1) amortized.

(item)

Source from the content-addressed store, hash-verified

44 * Prepend an item to the head. O(1) amortized.
45 */
46 unshift(item) {
47 if (this.#size > this.#mask) {
48 this.#grow();
49 }
50 this.#head = (this.#head - 1 + this.#mask + 1) & this.#mask;
51 this.#backing[this.#head] = item;
52 this.#size++;
53 }
54
55 /**
56 * Remove and return the item at the head. O(1).

Callers 15

_http_outgoing.jsFile · 0.80
url.jsFile · 0.80
_addListenerFunction · 0.80
callbackTrampolineFunction · 0.80
[kSetServersInternal]Method · 0.80
prependListenerFunction · 0.80
addChunkFunction · 0.80
#flushBufferSyncMethod · 0.80
#flushSyncUtf8Method · 0.80
#resolvePendingWritesMethod · 0.80

Calls 1

#growMethod · 0.95

Tested by

no test coverage detected