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

@caputchin/determinism

v0.2.0

Published

Make a JS environment deterministic so the same code runs bit-identically in the browser and on the server: deterministic transcendental math (fdlibm kernels) plus a Math swap. The shared determinism primitive for Caputchin replay presets.

Readme

@caputchin/determinism

Make a JS environment behave deterministically, so the same code produces the same result in the browser and on the server. This is the shared determinism primitive the Caputchin replay presets build on: a game library bundled into a preset can compute its physics/math bit-for-bit identically in live play and in the headless server replay.

It is a focused primitive, not a game-authoring model: no reducer, no contract, no engine. You depend on it to make the environment deterministic, then pair it with a fixed-step seeded loop for full determinism.

What it provides

  • capMath - deterministic transcendentals (sin, cos, tan, asin, acos, atan, atan2, exp, log, pow, hypot, cbrt, hyperbolics). fdlibm-derived kernels built only from operations that are bit-identical across V8 / JSC / SpiderMonkey and CPU architectures (+ - * /, Math.sqrt, bit surgery). The native Math.sin/cos/pow/... are libm-approximated and diverge between a player's ARM device and an x86-64 server, which would reject honest players; these do not.
  • swapMath(scope?) - swap the engine-visible Math.* transcendentals to capMath, so even a bundled engine that calls Math.sin(...) directly becomes deterministic. Leaves the IEEE-754-mandated members (sqrt/abs/floor/...) intact (they are already deterministic). It does NOT neutralize wall-clock / entropy / IO globals; a framework engine needs requestAnimationFrame / performance / navigator to run.
  • makeDeterministic(scope?) - the single composition point. Today it is swapMath; future deterministic stubs (a seeded clock, env-safe RNG) join here.

Usage

import { makeDeterministic } from '@caputchin/determinism';

// Once, before the bundled engine runs (same call live and on replay):
makeDeterministic(globalThis);

Or call the deterministic math directly instead of Math:

import { capMath } from '@caputchin/determinism';
const a = capMath.atan2(dy, dx); // bit-identical everywhere

The determinism rule

Float + - * / and Math.sqrt/abs/floor/round are IEEE-754 correctly rounded, so they are deterministic by default. The transcendentals are not, which is the gap this kit closes. Pair the Math swap with a deterministic loop (fixed timestep, seeded RNG, no wall clock in the sim) and the whole environment is reproducible.