
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
health-calculator
Advanced tools
A library to help calculate well known health-related metrics.
npm i health-calculator
import { dietary } from 'health-calculator';
console.log( dietary.tdee( 'male', 20, 80, 180, 'moderate' ) );
or:
import { tdee } from 'health-calculator/dietary';
console.log( tdee( 'male', 20, 80, 180, 'moderate' ) );
See API reference for more.
numbernumberBodyCategoryBodyCategoryBodyCategoryBodyCategorynumbernumbernumbernumbernumbernumberCalculates body mass index (BMI).
Kind: inner method of body_measurement
Returns: number - BMI.
| Param | Type | Description |
|---|---|---|
| weight | number | Weight of a person. |
| height | number | Height of a person. |
| imperial | boolean | Flag to use imperial (lb and inch). Default to use metric (kg and cm). |
numberCalculates waist-to-height ratio (WHtR).
Kind: inner method of body_measurement
Returns: number - WHtR.
See: https://en.wikipedia.org/wiki/Waist-to-height_ratio
| Param | Type | Description |
|---|---|---|
| waistCircumference | number | Waist circumference of a person. |
| height | number | Height of a person. |
| imperial | boolean | Flag to use imperial (lb and inch). Default to use metric (kg and cm). |
BodyCategoryCategorize the boundaries for WHtR in terms of their health implications.
Kind: inner method of body_measurement
Returns: BodyCategory - Category.
See: https://en.wikipedia.org/wiki/Waist-to-height_ratio#Health_implications
| Param | Type | Description |
|---|---|---|
| gender | Gender | 'male' or 'female'. |
| age | number | Age between 18 and 120. |
| ratio | number | WHtR. |
BodyCategoryWHtR category for children (up to 15 yeard old).
Kind: inner method of body_measurement
Returns: BodyCategory - Category.
| Param | Type | Description |
|---|---|---|
| ratio | number | WHtR. |
BodyCategoryWHtR category for adult male.
Kind: inner method of body_measurement
Returns: BodyCategory - Category.
| Param | Type | Description |
|---|---|---|
| ratio | number | WHtR. |
BodyCategoryWHtR category for adult female.
Kind: inner method of body_measurement
Returns: BodyCategory - Category.
| Param | Type | Description |
|---|---|---|
| ratio | number | WHtR. |
numberCalculates waist-to-hip ratio (WHR).
Kind: inner method of body_measurement
Returns: number - WHR.
See: https://en.wikipedia.org/wiki/Waist%E2%80%93hip_ratio
| Param | Type | Description |
|---|---|---|
| waistCircumference | number | Waist circumference of a person. |
| hipCircumference | number | Hip circumference of a person. |
| imperial | boolean | Flag to use imperial (lb and inch). Default to use metric (kg and cm). |
numberCalculates body fat percentage (BFP) using BMI.
Kind: inner method of body_measurement
Returns: number - BFP.
See: https://en.wikipedia.org/wiki/Body_fat_percentage#From_BMI
| Param | Type | Description |
|---|---|---|
| gender | Gender | 'male' or 'female'. |
| age | number | Age between 18 and 120. |
| bmi | number | BMI result. |
numberCalculates lean body mass (LBM) using the Boer formula.
Kind: inner method of body_measurement
Returns: number - LBM.
See: https://en.wikipedia.org/wiki/Lean_body_mass#Boer[3]
| Param | Type | Description |
|---|---|---|
| gender | Gender | 'male' or 'female'. |
| weight | number | Weight of a person. |
| height | number | Height of a person. |
| imperial | boolean | Flag to use imperial (lb and inch). Default to use metric (kg and cm). |
numberCalculates relative fat mass (RFM).
Kind: inner method of body_measurement
Returns: number - RFM.
| Param | Type | Description |
|---|---|---|
| gender | Gender | 'male' or 'female'. |
| height | number | Height of a person. |
| waistCircumference | number | Waist circumference of a person. |
| imperial | boolean | Flag to use imperial (lb and inch). Default to use metric (kg and cm). |
numberCalculates fat-free mass index (FFMI).
Kind: inner method of body_measurement
Returns: number - FFMI.
| Param | Type | Description |
|---|---|---|
| weight | number | Weight of a person. |
| height | number | Height of a person. |
| bodyFat | number | Body fat percentage. |
| imperial | boolean | Flag to use imperial (lb and inch). Default to use metric (kg and cm). |
numbernumbernumbernumbernumbernumbernumberCalculates basal metabolic rate (BMW); the number of calories our body needs to accomplish its most basic (basal) life-sustaining functions.
Kind: inner method of dietary
Returns: number - BMI.
| Param | Type | Description |
|---|---|---|
| gender | Gender | 'male' or 'female'. |
| age | number | Age between 18 and 120. |
| weight | number | Weight between 15kg and 635kg. |
| height | number | Height of a person. |
| imperial | boolean | Flag to use imperial (lb and inch). Default to use metric (kg and cm). |
| equation | BmrEquation | Equation to use ('harrisBenedict', 'rozaAndShizgal', or 'mifflin'). Default to 'mifflin'. |
numberCalculates BMR using Harris-Benedict equation.
Kind: inner method of dietary
Returns: number - BMR.
See: https://en.wikipedia.org/wiki/Harris%E2%80%93Benedict_equation
| Param | Type | Description |
|---|---|---|
| gender | Gender | 'male' or 'female'. |
| age | number | Age between 18 and 120. |
| weight | number | Weight between 15kg and 635kg. |
| height | number | Height of a person. |
numberCalculates BMR using revised Harris-Benedict equation by Roza and Shizgal.
Kind: inner method of dietary
Returns: number - BMR.
See: https://en.wikipedia.org/wiki/Harris%E2%80%93Benedict_equation
| Param | Type | Description |
|---|---|---|
| gender | Gender | 'male' or 'female'. |
| age | number | Age between 18 and 120. |
| weight | number | Weight between 15kg and 635kg. |
| height | number | Height of a person. |
numberCalculates BMR using revised Harris-Benedict equation by Mifflin.
Kind: inner method of dietary
Returns: number - BMR.
See: https://en.wikipedia.org/wiki/Harris%E2%80%93Benedict_equation
| Param | Type | Description |
|---|---|---|
| gender | Gender | 'male' or 'female'. |
| age | number | Age between 18 and 120. |
| weight | number | Weight between 15kg and 635kg. |
| height | number | Height of a person. |
numberCalculates total daily energy expenditure (TDEE); the number of calories our body burns daily to perform its bodily functions based on activity level.
Kind: inner method of dietary
Returns: number - BMR.
| Param | Type | Description |
|---|---|---|
| gender | Gender | 'male' or 'female'. |
| age | number | Age between 18 and 120. |
| weight | number | Weight between 15kg and 635kg. |
| height | number | Height of a person. |
| activity | ActivityLevel | Activity level. |
| imperial | boolean | Flag to use imperial (lb and inch). Default to use metric (kg and cm). |
| equation | BmrEquation | Equation to use ('harrisBenedict', 'rozaAndShizgal', or 'mifflin'). Default to 'mifflin'. |
numberCalculates acceptable macronutrient range (AMDR).
Kind: inner method of dietary
Returns: number - BMR.
| Param | Type | Description |
|---|---|---|
| gender | Gender | 'male' or 'female'. |
| age | number | Age between 18 and 120. |
| weight | number | Weight between 15kg and 635kg. |
| height | number | Height of a person. |
| activity | ActivityLevel | Activity level. |
| imperial | boolean | Flag to use imperial (lb and inch). Default to use metric (kg and cm). |
| equation | BmrEquation | Equation to use ('harrisBenedict', 'rozaAndShizgal', or 'mifflin'). Default to 'mifflin'. |
numbernumbernumberCalculates one-repetition maximum (1RM) using various formula.
Kind: inner method of sports
Returns: number - One rep max.
| Param | Type | Description |
|---|---|---|
| reps | number | Number of repetition of a given weight. |
| weight | number | Weight being lifted for a given reps. |
| formula | OneRmFormula | Formula to use. |
numberCalculates maximum heart rate (HR) of a given age and formula.
Kind: inner method of sports
Returns: number - HRmax in BPM (beats per minute).
| Param | Type | Description |
|---|---|---|
| age | number | Person age. |
| formula | HRMaxFormula | Formula to use. |
numbernumbernumbernumbernumberConverts cm to inch.
Kind: inner method of util
Returns: number - Length in inch.
| Param | Type | Description |
|---|---|---|
| cm | number | Length in cm. |
numberConverts inch to cm.
Kind: inner method of util
Returns: number - Length in cm.
| Param | Type | Description |
|---|---|---|
| inch | number | Length in inch. |
numberConverts lb to kg.
Kind: inner method of util
Returns: number - Weight in kg.
| Param | Type | Description |
|---|---|---|
| lb | number | Weight in lb. |
numberConverts kg to lb.
Kind: inner method of util
Returns: number - Weight in lb.
| Param | Type | Description |
|---|---|---|
| kg | number | Weight in kg. |
FAQs
A library to help calculate well known health-related metrics.
We found that health-calculator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.