npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

zbush

v0.0.10

Published

A very fast spatial index for 2D points based on a Z-Order space filling curve and BIGMIN search space pruning

Readme

ZBush

A very fast spatial index for 2D points based on a Z-Order space filling curve and BIGMIN search space pruning.

Installation

We publish this project as the package zbush on NPM

npm install zbush

Usage

const index = new ZBush();

for (const {x, y} of items) {
  index.add(x, y);
}

index.finish();

const foundIds = index.range(minX, minY, maxX, maxY);

Note: at the moment the x and y coordinates of points added must be of non-negative integral type and fit into 32-bit, i.e. in [0, 2^32-1]. We might relax this constraint in the future.

How It Works

We sort 2d points along a Z-order space-filling curve and use an optimization ("BIGMIN") to skip over irrelevant data when walking the curve.

| Z-curve with query bounding box | Z-curve with BIGMIN skipping | |-|-| | | |

If you are interested in a high-level overview check out my blog post. The ideas implemented here originated as experiments in tinygraph.org but really go back to the 80s.

For experiments, context, implementation details, and ideas for further improvements

  • https://github.com/tinygraph/tinygraph/issues/22
  • https://github.com/tinygraph/tinygraph/pull/68
  • https://github.com/tinygraph/tinygraph/issues/71
  • https://github.com/tinygraph/tinygraph/issues/70
  • https://github.com/tinygraph/tinygraph/blob/main/tinygraph/tinygraph-zorder.c
  • https://github.com/tinygraph/tinygraph/blob/main/tinygraph/tinygraph-index.c

Note: The core ideas implemented here are very flexible and allow e.g. to index more dimensions than two, indexing more shapes and not just points, have a fast WebAssembly version, and more. If you come across limitations or have use-cases not covered here, please do open an issue and let us know.

Similar

Similar projects for point indices using R-Tree or KD-Tree data structures

  • https://github.com/mourner/rbush
  • https://github.com/mourner/kdbush
  • https://github.com/mourner/flatbush

Release

Checklist

  • [ ] Bump version in package.json
  • [ ] Tag the release git tag vx.y.z -a
  • [ ] Push the tag git push origin vx.y.z

There is a GitHub Action publishing to the zbush package on NPM with provenance attestation.

License

Copyright © 2025 Daniel J. H.

Distributed under the MIT License (MIT).