Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Perform a 1d bin search where bins are defined by an input edge vector.
var binsearch = require( 'binsearch' ),
edges, numEdges = 11,
idx;
// Create a 1d edge array...
edges = new Array( numEdges );
// Note: numBins = numEdges-1
for ( var i = 0; i < numEdges; i++ ) {
edges[ i ] = i-0.5;
}
// Perform a bin search...
idx = binsearch( edges, 0 );
// returns idx = 0
idx = binsearch( edges, 1 );
// returns idx = 1
idx = binsearch( edges, 5.2345 );
// returns idx = 5
idx = binsearch( edges, 5.5001 );
// returns idx = 6
idx = binsearch( edges, -5 );
// returns idx = -1
idx = binsearch( edges, 100 );
// returns idx = 10
Unit tests use the Mocha test framework with Chai assertions.
Assuming you have installed Mocha, execute the following command in the top-level application directory to run the tests:
$ mocha
All new feature development should have corresponding unit tests to validate correct functionality.
Copyright © 2014. Athan Reines.
FAQs
Perform a bin search over a 1d edge vector
We found that binsearch 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
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.