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

Method removeAt

lib/internal/priority_queue.js:94–107  ·  view source on GitHub ↗
(pos)

Source from the content-addressed store, hash-verified

92 }
93
94 removeAt(pos) {
95 const heap = this.#heap;
96 let size = this.#size;
97 heap[pos] = heap[size];
98 heap[size] = undefined;
99 size = --this.#size;
100
101 if (size > 0 && pos <= size) {
102 if (pos > 1 && this.#compare(heap[pos >> 1], heap[pos]) > 0)
103 this.percolateUp(pos);
104 else
105 this.percolateDown(pos);
106 }
107 }
108
109 shift() {
110 const heap = this.#heap;

Callers 3

shiftMethod · 0.95
unenrollFunction · 0.45

Calls 2

percolateUpMethod · 0.95
percolateDownMethod · 0.95

Tested by

no test coverage detected