![Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support](https://cdn.sanity.io/images/cgdhsj6q/production/2cf8fa428fd5329a3f9bc7f76a597ac829bb1b3d-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
k-nearest neighbors search for RBush. Implements a simple depth-first kNN search algorithm using a priority queue.
import RBush from 'rbush';
import knn from 'rbush-knn';
const tree = new RBush(); // create RBush tree
tree.load(data); // bulk insert
const neighbors = knn(tree, 40, 40, 10); // return 10 nearest items around point [40, 40]
You can optionally pass a filter function to find k neighbors that satisfy a certain condition:
const neighbors = knn(tree, 40, 40, 10, function (item) {
return item.foo === 'bar';
});
knn(tree, x, y, [k, filterFn, maxDistance])
tree
: an RBush treex
, y
: query coordinatesk
: number of neighbors to search for (Infinity
by default)filterFn
: optional filter function; k
nearest items where filterFn(item) === true
will be returned.maxDistance
(optional): maximum distance between neighbors and the query coordinates (Infinity
by default)FAQs
k-neareset neighbors search for RBush
We found that rbush-knn demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.