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

@aadifit/tdee-calc

v1.0.0

Published

Zero-dependency TDEE, BMR and macro calculator — Mifflin-St Jeor, Katch-McArdle and Harris-Benedict formulas.

Readme

@aadifit/tdee-calc

Zero-dependency TDEE, BMR and macro calculator for Node.js (and any bundler — webpack, esbuild, Vite — for browser use). Implements the three formulas actually used in clinical and fitness practice — Mifflin-St Jeor, Katch-McArdle and Harris-Benedict — plus a goal-based macro split (protein/carb/fat grams). No build step, no dependencies, ~150 lines.

Install

npm install @aadifit/tdee-calc

Usage

const { mifflinStJeor, tdee, macroSplit } = require('@aadifit/tdee-calc');

const bmr = mifflinStJeor({ weightKg: 80, heightCm: 180, age: 30, sex: 'male' });
// 1780

const maintenance = tdee(bmr, 'moderate'); // 'sedentary'|'light'|'moderate'|'active'|'very_active'
// 2759

const macros = macroSplit(maintenance, { weightKg: 80, goal: 'maintain' }); // 'cut'|'maintain'|'bulk'
// { goal: 'maintain', targetKcal: 2759, proteinG: 160, fatG: 86, carbG: 336 }

If you know your body fat percentage, katchMcArdle is more accurate than formulas based on height/weight alone:

const { katchMcArdle } = require('@aadifit/tdee-calc');
katchMcArdle({ weightKg: 80, bodyFatPct: 15 }); // 1838.8

API

mifflinStJeor({ weightKg, heightCm, age, sex }) → number

The most accurate general-population BMR formula in validation studies (Frankenfield et al., 2005, J Am Diet Assoc 105(5):775-89).

katchMcArdle({ weightKg, bodyFatPct }) → number

Uses lean body mass. More accurate than height/weight-based formulas for people with a known, reliable body fat percentage.

harrisBenedict({ weightKg, heightCm, age, sex }) → number

The 1984 revision (Roza & Shizgal). Included for compatibility with older tools; prefer mifflinStJeor for new work.

tdee(bmr, activityLevel) → number

activityLevel is one of sedentary (1.2) · light (1.375) · moderate (1.55) · active (1.725) · very_active (1.9).

macroSplit(tdeeKcal, { weightKg, goal, proteinPerKg?, fatPct?, kcalAdjustPct? }) → { goal, targetKcal, proteinG, fatG, carbG }

goal is cut (-20% kcal, 2.2 g/kg protein) · maintain · bulk (+10% kcal, 1.8 g/kg protein). Override any default per call.

Every function throws a TypeError with a specific message on bad input (negative weight, unknown activity level, etc.) rather than returning NaN.

Why this exists

Most TDEE calculators live behind a wall of ads with no way to verify the math or reuse it programmatically. This package is the calculation engine only — MIT licensed, unit-tested against hand-derived reference values, and usable in any Node or browser project. It's maintained by AadiFit, where you can try the full calculator with body composition tracking, activity logging and an adaptive plan built around your numbers at aadifit.com/tdee-calculator.

Testing

npm test

16 tests, each checked against hand-derived reference values for every formula (see test/formulas.test.js).

License

MIT © AadiFit