New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

priority-queue

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

priority-queue - npm Package Compare versions

Comparing version
0.2.0
to
0.2.1
+3
-0
CHANGELOG.md

@@ -0,1 +1,4 @@

## 0.2.1
* fix critical crashing bug (issue #3)
## 0.2.0

@@ -2,0 +5,0 @@ * BREAKING: queue(...) requires priority as the 3rd argument, no longer optional

+1
-1
{
"name": "priority-queue",
"version": "0.2.0",
"version": "0.2.1",
"description": "functional, data oriented priority queue that doesn't suck",

@@ -5,0 +5,0 @@ "main": "priority-queue.js",

@@ -84,6 +84,6 @@

if (left <= heap.length && heap.arr[left].priority > heap.arr[largest].priority)
if (left < heap.length && heap.arr[left].priority > heap.arr[largest].priority)
largest = left
if (right <= heap.length && heap.arr[right].priority > heap.arr[largest].priority)
if (right < heap.length && heap.arr[right].priority > heap.arr[largest].priority)
largest = right

@@ -90,0 +90,0 @@

+36
-0

@@ -118,2 +118,38 @@ import PQ from './priority-queue.js'

it('github issue #3', () => {
// this specific set of calls causes a crash
const obj = PQ.create()
PQ.queue(obj, 50, 0)
PQ.dequeue(obj)
PQ.queue(obj, 49, -208.01627535185656)
PQ.queue(obj, 51, -210.25305660400815)
PQ.dequeue(obj)
PQ.queue(obj, 48, -224.8892169096033)
PQ.dequeue(obj)
PQ.queue(obj, 0, -248.46823429680552)
PQ.queue(obj, 34, -228.26373397712936)
PQ.queue(obj, 35, -239.23167864379525)
PQ.queue(obj, 37, -266.89894250109546)
PQ.queue(obj, 86, -349.68815199723747)
PQ.queue(obj, 87, -365.64707670906125)
PQ.queue(obj, 113, -320.62073398614984)
PQ.queue(obj, 116, -420.20447008152644)
PQ.queue(obj, 114, -297.2795767836452)
PQ.queue(obj, 115, -275.62135818236425)
PQ.queue(obj, 36, -252.2200007506263)
PQ.queue(obj, 79, -252.54674757055753)
PQ.queue(obj, 88, -382.0386737765449)
PQ.queue(obj, 8, -311.2518915300308)
PQ.dequeue(obj)
PQ.queue(obj, 110, -369.64947731728694)
PQ.queue(obj, 0, -245.463916203665)
})
describe('test with an object', () => {

@@ -120,0 +156,0 @@ it('basic test', () => {