Skip to content

Commit eb6b386

Browse files
mscdexdanielleadams
authored andcommitted
lib: remove unused code
PR-URL: #36632 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
1 parent 7fe1b5e commit eb6b386

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

lib/internal/priority_queue.js

-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const {
44
Array,
5-
ArrayPrototypeIndexOf,
65
Symbol,
76
} = primordials;
87

@@ -105,17 +104,6 @@ module.exports = class PriorityQueue {
105104
}
106105
}
107106

108-
remove(value) {
109-
const heap = this[kHeap];
110-
const pos = ArrayPrototypeIndexOf(heap, value);
111-
if (pos < 1)
112-
return false;
113-
114-
this.removeAt(pos);
115-
116-
return true;
117-
}
118-
119107
shift() {
120108
const heap = this[kHeap];
121109
const value = heap[1];

test/parallel/test-priority-queue.js

-21
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,6 @@ const PriorityQueue = require('internal/priority_queue');
4343
assert.strictEqual(queue.shift(), undefined);
4444
}
4545

46-
{
47-
// Checks that remove works as expected.
48-
const queue = new PriorityQueue();
49-
for (let i = 16; i > 0; i--)
50-
queue.insert(i);
51-
52-
const removed = [5, 10, 15];
53-
for (const id of removed)
54-
assert(queue.remove(id));
55-
56-
assert(!queue.remove(100));
57-
assert(!queue.remove(-100));
58-
59-
for (let i = 1; i < 17; i++) {
60-
if (removed.indexOf(i) < 0)
61-
assert.strictEqual(queue.shift(), i);
62-
}
63-
64-
assert.strictEqual(queue.shift(), undefined);
65-
}
66-
6746
{
6847
// Make a max heap with a custom sort function.
6948
const queue = new PriorityQueue((a, b) => b - a);

0 commit comments

Comments
 (0)