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

dive-math

v0.1.0

Published

Scuba diving math: gas laws, MOD/END, blending, fills, oxygen exposure, gas planning and CCR loop math.

Readme

dive-math

Scuba diving math for TypeScript: gas laws, MOD/END, blending, fills, oxygen exposure, gas planning and CCR loop math.

npm CI Docs

Safety. This library is a reference implementation for education and tooling. It is not a dive computer or a blending certification. Verify every fill and dive plan independently, with training and approved tools.

Install

npm install dive-math

The package is ESM-only, has zero runtime dependencies, and ships its own types.

Requirements

  • Node.js 22 or later. CommonJS projects can load it with import(), or with require() (Node 22.12+ loads ES modules synchronously).
  • TypeScript 4.7 or later, with moduleResolution set to node16, nodenext or bundler (5.0+). The legacy node/node10 resolution can't see the subpath exports, and a node16 project must itself be ESM ("type": "module" or .mts).
  • Bundlers and browsers: works with any bundler (Vite, Next.js, webpack); output is ES2022 (Chrome/Edge 94+, Firefox 93+, Safari 16.4+).

Quick start

import { gas, mod, end, bestMix } from 'dive-math/gas'

mod(gas(0.32), 1.4) // => 33.75
end(gas(0.18, 0.45), 60) // => 28.5
bestMix({ depthM: 60, maxPpo2: 1.4, targetEndM: 30 }).fhe // => 0.4286

Import from the package root for everything, or from a subpath to keep bundles small.

Modules

| Module | Subpath | What it covers | | --------- | --------------------- | --------------------------------------------------------- | | units | dive-math/units | Pressure, depth, volume, flow and temperature conversions | | pressure | dive-math/pressure | Depth/pressure (ATA), water type, gauge/absolute | | altitude | dive-math/altitude | Surface pressure at altitude, theoretical ocean depth | | gas | dive-math/gas | Gas mixes, ppO₂, MOD, END, EAD, best mix | | density | dive-math/density | Gas density and density limits | | real-gas | dive-math/real-gas | Virial compressibility (Z) for O₂, N₂ and He mixes | | cylinders | dive-math/cylinders | Cylinder tables, free gas, tank factor | | equipment | dive-math/equipment | Booster presets and common mixes | | blending | dive-math/blending | Partial-pressure blending, top-up mixes, nitrox stick | | fill | dive-math/fill | Cascade, booster and hot-fill calculations | | oxygen | dive-math/oxygen | CNS and OTU oxygen exposure | | planning | dive-math/planning | SAC/RMV, rock bottom, turn pressures, tank matching | | ccr | dive-math/ccr | Loop ppO₂ and inert fractions, SCR, O₂ cell checks |

Documentation

License

MIT. Real-gas virial coefficients and reference values are derived from GasPlanner (MIT); see THIRD_PARTY_NOTICES.md.