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

scuba-gas-calculator

v1.0.0

Published

Calculator for inline nitrox- and trimix blending, and for gas limits

Readme

DISCLAIMER

IMPORTANT: This is published under the MIT licence, and the authors, owners and publishers of this library take NO RESPONSIBILITY for the risks it's uses impose.

When diving and mixing gas it's always important to use ones own knowledge and thinking to make sure things are set correctly.

Using the wrong gas mixture at the wrong depth be fatal. If the numbers seem off, double check and report it. Blending diving gases incorrectly can also be fatal. An incorrect mix may kill its user. ALWAYS measure the gas that is mixed.

  • DO NOT Use this to dive with mixtures with which you have no training otherwise.
  • DO NOT Use this to mix gases without proper blender-training.
  • DO Forward these warnings if you ever build an app using this library

Usage

gas-limits

This can be used to calculate the maximum operational depth (MOD) and maximum narcotic depth (MND) for a given mixture of oxygen, nitrogen and helium. By default, the nitrogen-fraction is set to whatever fraction is left after oxygen and helium.

Basic usage:

const limits = calculateGasLimits({oxygen: 0.21});
console.log(limits.maxNarcoticDepthMeters) // 30
console.log(limits.maxNarcoticDepthAta) // 4
console.log(limits.maxOperationalDepthMeters) // 56.67
console.log(limits.maxOperationalDepthAta) // 6.667

Use helium for a trimix-dive

const limits = calculateGasLimits({oxygen: 0.21, helium: 0.35});

Use a more conservative ppO2 for a deco-dive bottom-phase

const limits = calculateGasLimits({oxygen: 0.21}, {maxPPO2: 1.2});

Use a more aggressive ppO2 for a deco-dive deco-phase

const limits = calculateGasLimits({oxygen: 0.21}, {maxPPO2: 1.6});

Assume oxygen is not narcotic

const limits = calculateGasLimits({oxygen: 0.21}, {oxygenIsNarcotic: false});
// Note: Default is true, as this is the most convervative option

gas-blender

This can be used to calculate the setpoints to use when mixing a new gas using an inline blender. Here you input your current mix and pressure, and the desired mix and pressure. Then you will get the percentages of oxygen and helium you need to achieve that mix.

Basic usage

const result = calculateBlenderSettings({
    fillPressureBar: 90,
    oxygenFraction: 0.21, //Air
}, {
    fillPressureBar: 232,
    oxygenFraction: 0.32, // Nitrox 32
})

console.log(result.oxygenSetpoint) //39

Trimix blending

const result = calculateBlenderSettings({
    fillPressureBar: 100,
    oxygenFraction: 0.32, // Nitrox 32
}, {
    // Trimix 21
    fillPressureBar: 232,    
    oxygenFraction: 0.21,
    heliumFraction: 0.35, 
})

console.log(result.oxygenSetpoint) //12.7
console.log(result.heliumSetpoint) //61.5