
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Basic binary heap tree using linked lists
var BinaryHeap = require('binaryheap');
var heap = new BinaryHeap();
var a = [6, 5, 3, 1, 8, 7, 2, 4];
a.forEach(function (k) {
heap.insert({ value: k }, k);
});
heap.print();
while (heap.length) {
console.log('popping', heap.pop().value);
}
By default it stores as a max-heap, if you pass truthy to the constructor though it will behave as a min-heap.
insert(obj, key)
-- obj can be any new or existing object, and key is any
value that behaves sanely with >
or <
pop()
-- removes and returns the maximum or minimum object from the root
of the heapremove(obj)
-- removes a previously inserted object from the heapprint()
-- mostly for debugging purposes prints a graphviz dot style
digraph to confirm orderinglength
-- number of objects currently in the heapFAQs
A simple binary heap
The npm package binaryheap receives a total of 18,938 weekly downloads. As such, binaryheap popularity was classified as popular.
We found that binaryheap 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
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.