Skip to content

Commit 695af3e

Browse files
committed
change name
1 parent 24a2065 commit 695af3e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/internal/priority_queue.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,22 @@ module.exports = class PriorityQueue {
5151
const item = heap[pos];
5252

5353
while (pos <= hsize) {
54-
let left = pos << 1;
55-
const right = left + 1;
56-
let child = heap[left];
54+
let child = pos << 1;
55+
const nextChild = child + 1;
56+
let childItem = heap[child];
5757

58-
if (right <= size && compare(heap[right], child) < 0) {
59-
left = right;
60-
child = heap[right];
58+
if (nextChild <= size && compare(heap[nextChild], childItem) < 0) {
59+
child = nextChild;
60+
childItem = heap[nextChild];
6161
}
6262

63-
if (compare(item, child) <= 0) break;
63+
if (compare(item, childItem) <= 0) break;
6464

6565
if (setPosition !== undefined)
66-
setPosition(child, pos);
66+
setPosition(childItem, pos);
6767

68-
heap[pos] = child;
69-
pos = left;
68+
heap[pos] = childItem;
69+
pos = child;
7070
}
7171

7272
heap[pos] = item;

0 commit comments

Comments
 (0)