Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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 972,394 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.