Releases: mourner/kdbush
Releases · mourner/kdbush
v4.0.2
v4.0.1
v4.0.0
// old API
const index = new KDBush(points, p => p.x, p => p.y, 64, Uint32Array);
// new API
const index = new KDBush(points.length, 64, Uint32Array);
for (const {x, y} of points) index.add(x, y);
index.finish();
The new API is more verbose, but it allows creating an index without requiring to store coordinates in some intermediate point array, allowing more efficient memory use, and allows transferring (or saving to a binary file) and recreating an index from a single array buffer:
// instantly transfer the index from a worker to the main thread
postMessage(index.data, [index.data]);
// reconstruct the index from a raw array buffer
const index = Flatbush.from(e.data);
- Dropped CommonJS entry point in favor of a ESM-only one (there's still a UMD bundle provided for browsers though).
- Dropped transpilation for IE11 (although you can still do it on your end and it will work).