Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
GridIndex is a 2D spatial index that is transferable.
Pairs of keys and boxes can be inserted into GridIndex. The grid can then be queried to find all the keys that intersect a given box. The grid can be serialized to an ArrayBuffer so that it can be transferred between WebWorkers.
You should probably use rbush instead of GridIndex! It's easier to use and it's as fast or faster in many cases.
GridIndex can be faster in a specific set of cases:
GridIndex is used by mapbox-gl-js for label collision detection and feature picking.
var GridIndex = require('grid-index');
var grid = new GridIndex(100, 5, 0);
var key1 = 1;
var key2 = 2;
var key3 = 3;
grid.insert(key1, 30, 10, 35, 15);
grid.insert(key2, 60, 20, 65, 25);
grid.insert(key3, 40, 10, 45, 15);
var keys = grid.query(0, 0, 100, 13);
// `keys` is now [key1, key3]
var arrayBuffer = grid.toArrayBuffer();
// transfer the ArrayBuffer to a different worker
var grid2 = new GridIndex(arrayBuffer);
var keys2 = grid2.query(0, 0, 100, 13);
// `keys2` is now [key1, key3]
GridIndex(extent, n, padding)
Create a new GridIndex.
4096
.4
would divide the grid into 16 cells.GridIndex(arrayBuffer)
Unserialize a GridIndex.
gridIndex.toArrayBuffer()
.gridIndex.insert(key, x1, y1, x2, y2)
Insert a new key, box pair into the grid.
gridIndex.query(key, x1, y1, x2, y2, intersectionTest?)
Find the keys that intersect with the given box.
returns an array of keys.
gridIndex.toArrayBuffer()
Serialize a GridIndex to an ArrayBuffer so that it can be transferred between WebWorkers efficiently.
returns an ArrayBuffer that can later be deserialized with new GridIndex(arrayBuffer)
.
FAQs
A 2D spatial index for axis-aligned boxes
The npm package grid-index receives a total of 830,350 weekly downloads. As such, grid-index popularity was classified as popular.
We found that grid-index demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.