
Security News
Rust RFC Proposes a Security Tab on crates.io for RustSec Advisories
Rustâs crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.
A javascript binary heap implementation for Node.js and browser with browserify.
$ npm install bheap
var BinaryHeap = require('bheap')
var heap = new BinaryHeap(function(a, b) {
return a.cash - b.cash;
})
heap.push({ cash: 250, name: 'Valentina' })
heap.push({ cash: 300, name: 'Jano' })
heap.push({ cash: 150, name: 'Fran' )
heap.size // 3
heap.top() // { cash: 300, name: 'Jano' }
heap.pop() // { cash: 300, name: 'Jano' }
heap.size // 2
It creates a new instance of BinaryHeap based on its parameters.
Time complexity: O(n) such that n === array.length
Elements that are inserted in binary heap.
a is great than bais less than ba is equal to bIt is a function that binary heap uses internally to sort its elements.
It is default comparator if any is passed to constructor and compares two Number or String objects. It is static property of BinaryHeap.
The size of the binary heap.
Time complexity: O(1)
BinaryHeapGets the top element of the binary heap.
Throws an Error when the heap is empty.
Time complexity: O(1)
BinaryHeapPops the top element of instance of binary heap.
Throws an Error when the heap is empty.
Time complexity: O(log(n)) such that n === this.size
Push the element at the binary heap and returns its new size.
Time complexity: O(log(n)) such that n === this.size
Sets a new binary heap based on elements of array and keeps the same comparator.
Time complexity: O(n) such that n === array.length
size and not length?I wanted to keep the ECMAScript 6 conventions.
pop or top throw an error when binary heap is empty?I preferred intuitive API for javascript developers. Thus, I wanted to keep the same behaviour that other data structures as Array which doesn't throw an error when is empty and method pop is called.
$ npm test
MIT
FAQs
a javascript binary heap implementation
The npm package bheap receives a total of 22 weekly downloads. As such, bheap popularity was classified as not popular.
We found that bheap 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.

Security News
Rustâs crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.

Security News
/Research
Socket found a Rust typosquat (finch-rust) that loads sha-rust to steal credentials, using impersonation and an unpinned dependency to auto-deliver updates.

Research
/Security Fundamentals
A pair of typosquatted Go packages posing as Googleâs UUID library quietly turn helper functions into encrypted exfiltration channels to a paste site, putting developer and CI data at risk.