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

Method removeAt

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

* Remove the item at logical `index`, shifting later elements. O(n) worst case. * Used only on rare abort-signal cancellation path.

(index)

Source from the content-addressed store, hash-verified

111 * Used only on rare abort-signal cancellation path.
112 */
113 removeAt(index) {
114 if (index < 0 || index >= this.#size) return;
115 for (let i = index; i < this.#size - 1; i++) {
116 const from = (this.#head + i + 1) & this.#mask;
117 const to = (this.#head + i) & this.#mask;
118 this.#backing[to] = this.#backing[from];
119 }
120 const last = (this.#head + this.#size - 1) & this.#mask;
121 this.#backing[last] = undefined;
122 this.#size--;
123 }
124
125 /**
126 * Remove all items. O(n) for GC cleanup.

Callers 3

#clearTimerMethod · 0.45
onAbortFunction · 0.45
onAbortMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected