health-calculator
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

health-calculator

A library to help calculate well known health-related metrics.

Install

npm i health-calculator

Usage

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.

API Reference

Modules

body_measurement
dietary
sports
util

body_measurement

body_measurement~bmi(weight, height, imperial) ⇒ number

Calculates 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).

body_measurement~whtr(waistCircumference, height, imperial) ⇒ number

Calculates 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).

body_measurement~whtrCategory(gender, age, ratio) ⇒ BodyCategory

Categorize 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.

body_measurement~whtrChildren(ratio) ⇒ BodyCategory

WHtR category for children (up to 15 yeard old).

Kind: inner method of body_measurement
Returns: BodyCategory - Category.

Param Type Description
ratio number WHtR.

body_measurement~whtrMale(ratio) ⇒ BodyCategory

WHtR category for adult male.

Kind: inner method of body_measurement
Returns: BodyCategory - Category.

Param Type Description
ratio number WHtR.

body_measurement~whtrFemale(ratio) ⇒ BodyCategory

WHtR category for adult female.

Kind: inner method of body_measurement
Returns: BodyCategory - Category.

Param Type Description
ratio number WHtR.

body_measurement~whr(waistCircumference, hipCircumference, imperial) ⇒ number

Calculates 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).

body_measurement~bfp(gender, age, bmi) ⇒ number

Calculates 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.

body_measurement~lbm(gender, weight, height, imperial) ⇒ number

Calculates 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).

body_measurement~rfm(gender, height, waistCircumference, imperial) ⇒ number

Calculates 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).

body_measurement~ffmi(weight, height, bodyFat, imperial) ⇒ number

Calculates 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).

dietary

dietary~bmr(gender, age, weight, height, imperial, equation) ⇒ number

Calculates 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'.

dietary~bmrHarrisBenedict(gender, age, weight, height) ⇒ number

Calculates 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.

dietary~bmrRozaAndShizgal(gender, age, weight, height) ⇒ number

Calculates 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.

dietary~bmrMifflin(gender, age, weight, height) ⇒ number

Calculates 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.

dietary~tdee(gender, age, weight, height, activity, imperial, equation) ⇒ number

Calculates 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'.

dietary~amdr(gender, age, weight, height, activity, imperial, equation) ⇒ number

Calculates 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'.

sports

sports~oneRm(reps, weight, formula) ⇒ number

Calculates 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.

sports~hrMax(age, formula) ⇒ number

Calculates 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.

util

util~cmToInch(cm) ⇒ number

Converts cm to inch.

Kind: inner method of util
Returns: number - Length in inch.

Param Type Description
cm number Length in cm.

util~inchToCm(inch) ⇒ number

Converts inch to cm.

Kind: inner method of util
Returns: number - Length in cm.

Param Type Description
inch number Length in inch.

util~lbToKg(lb) ⇒ number

Converts lb to kg.

Kind: inner method of util
Returns: number - Weight in kg.

Param Type Description
lb number Weight in lb.

util~kgToLb(kg) ⇒ number

Converts kg to lb.

Kind: inner method of util
Returns: number - Weight in lb.

Param Type Description
kg number Weight in kg.

Package Sidebar

Install

npm i health-calculator

Weekly Downloads

138

Version

1.0.0

License

MIT

Unpacked Size

95.5 kB

Total Files

36

Last publish

Collaborators

  • gedex