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 🙏

© 2026 – Pkg Stats / Ryan Hefner

buf-im

v0.1.2

Published

Buffer Improved. Ultra-fast 1-to-1 byte and value comparison with token-efficient return states (1, 0, -1) optimized for AI and heuristic algorithms.

Readme

buf-im — Buffer Improved

Ultra-fast 1-to-1 byte and value comparison with token-efficient return states (1, 0, -1) optimized for AI, heuristic algorithms, and data pipelines.

Why buf-im?

Standard JavaScript comparison returns true/false. When every token in a response matters — especially for AI agents, heuristic scoring, or state machines — a three-state signal packs more information into a single token:

| State | Meaning | |-------|---------| | 1 | Match (identical data and same constructor type) | | 0 | No match (data differs or invalid input) | | -1 | Partial match (data is identical, but constructors differ — or data differs with different types for ne/nev) |

Install

npm install buf-im

Usage

import { bufim } from 'buf-im';

const b = new bufim();

// TypedArray comparison
const a1 = new Uint8Array([1, 2, 3]);
const a2 = new Uint8Array([1, 2, 3]);
b.eq(a1, a2); // → 1 (identical bytes, same type)

// DataView comparison
const dv1 = new DataView(new ArrayBuffer(4));
const dv2 = new DataView(new ArrayBuffer(4));
b.eq(dv1, dv2); // → 1

// Different types, same bytes
const u8 = new Uint8Array([10, 20]);
const i8 = new Int8Array([10, 20]);
b.eq(u8, i8);  // → -1 (bytes match, constructors differ)
b.eqv(u8, i8); // → -1 (value-equivalent, different type)

// Array-like
b.eq([1, 2, 3], [1, 2, 3]); // → -1 (no ArrayBuffer, values match)
b.eq([1, 2], [1, 3]);       // → 0

API

All methods accept two arguments (a, b) and return 1, 0, or -1.

Strict byte-level comparison (ArrayBuffer views only)

| Method | 1 | 0 | -1 | |--------|-----|-----|------| | eq(a, b) | Bytes + constructors match | Bytes differ | Bytes match, but constructors differ | | ne(a, b) | Bytes differ, same constructor | Bytes + constructors match | Bytes differ, different constructors | | ge(a, b) | Bytes match (up to b.length) AND a.length >= b.length, same constructor | Condition fails | Data matches condition, but constructors differ | | le(a, b) | Bytes match (up to a.length) AND a.length <= b.length, same constructor | Condition fails | Data matches condition, but constructors differ |

Value-level comparison (works across all iterables, including DataView)

| Method | 1 | 0 | -1 | |--------|-----|-----|------| | eqv(a, b) | Values + constructors match | Values differ | Values match, but constructors differ | | nev(a, b) | Values differ, same constructor | Values + constructors match | Values differ, different constructors | | gev(a, b) | Values match (up to b.length) AND a.length >= b.length, same constructor | Condition fails | Data matches condition, but constructors differ | | lev(a, b) | Values match (up to a.length) AND a.length <= b.length, same constructor | Condition fails | Data matches condition, but constructors differ |

Design notes

  • Raw byte mode (eq, ne, ge, le) — uses Uint8Array overlay over the underlying ArrayBuffer. Fast, no type coercion.
  • Value mode (eqv, nev, gev, lev) — iterates via index access or DataView.getUint8(). Works across different buffer view types.
  • Token-efficient — single-token return values (1, 0, -1) compress meaning for LLM/AI pipelines.
  • Zero dependencies. Pure ES module. sideEffects: false.

License

Restricted MIT License (Non-AI/ML with Source Attribution & Georgian Governing Law). See LICENSE.md.