-
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
const p = new PriorityQueue(function (a, b) {
return a.value < b.value;
});
p.push({ text: 'a', value: 2 });
p.push({ text: 'b', value: 7 });
p.push({ text: 'c', value: 4 });
p.push({ text: 'd', value: 1 });
p.push({ text: 'e', value: 8 });
p.push({ text: 'f', value: 1 });
p.pop();
p.pop();
p.pop();
p.pop();
I took the sample comparator code, and added a few pops to the end of the code. This crashes with an undefined value for 'b' being fed into the comparator.
error: Uncaught TypeError: Cannot read properties of undefined (reading 'value')
return a.value < b.value;
^
at PriorityQueue._comparator (file:///C:/....ts:78:24)
at PriorityQueue._compare (file:///C:/Users/newob/AppData/Local/deno/npm/registry.npmjs.org/p-queue-ts/1.2.0/dist/index.js:163:25)
at PriorityQueue._heapify (file:///C:/Users/newob/AppData/Local/deno/npm/registry.npmjs.org/p-queue-ts/1.2.0/dist/index.js:137:22)
at PriorityQueue.pop (file:///C:/Users/newob/AppData/Local/deno/npm/registry.npmjs.org/p-queue-ts/1.2.0/dist/index.js:72:14)
at ... (file:///C:/....ts:90:5)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working