Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
priority-heap-queue
Advanced tools
Readme
Stability: 1 - Experimental
Priority queue.
npm install priority-heap-queue
npm test
var PriorityQueue = require('priority-heap-queue');
var maxQueue = new PriorityQueue();
var minQueue = new PriorityQueue({kind: 'min'});
TODO
A JavaScript implementation of a priority queue using heap data structure.
WARNING: This implementation uses 1-indexed arrays (instead of 0-indexed) arrays.
array
: Array 1-indexed array storing the heap structureindex
: Integer index of the key to decreasevalue
: Integer the value to decrease the key toSets the value of the key at index
to value
and ensures heap property is maintained as a result.
array
: Array 1-indexed array storing the heap structureindex
: Integer index of the key to increasevalue
: Integer the value to increase the key toSets the value of the key at index
to value
and ensures heap property is maintained as a result.
array
: Array 1-indexed array storing the heap structureindex
: Integer the array index to start maxHeapify procedure onheapSize
: Integer heap sizeEnsures that the max-heap property is satisfied for the sub-tree rooted at index
of the array representing a binary tree.
array
: Array 1-indexed array storing the heap structureindex
: Integer the array index to start maxHeapify procedure onheapSize
: Integer heap sizeEnsures that the min-heap property is satisfied for the sub-tree rooted at index
of the array representing a binary tree.
options
:
kind
: String One of min
, max
(default: max
)Creates a new PriorityQueue.
index
: Integer index of the key to decreasevalue
: Integer the value to decrease the key toSets the value of the key at index
to value
and ensures heap property is maintained as a result.
Removes and returns the element with the largest key.
Removes and returns the element with the smallest key.
index
: Integer index of the key to increasevalue
: Integer the value to increase the key toSets the value of the key at index
to value
and ensures heap property is maintained as a result.
key
: Integer key of the element to be insertedelement
: Any element to associate with the keyInserts the element
into the priority queue at the specified key
.
Returns the element with the largest key. The element is not removed.
Returns the element with the smallest key. The element is not removed.
FAQs
Priority queue implemented using a heap
We found that priority-heap-queue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.