Fitness calculators for all your needs
This is a package which will help you perform calculations for your BMI, BMR, calorie needs, total daily energy expenditure, macros and much more
Usage
- Install the package using
npm i fitness-calculator
- Require the package in your Node application using
const fitnessCalculatorFunctions = require("fitness-calculator")
. - Use the methods by calling them from
fitnessCalculatorFunctions
.
Example
const fitnessCalculatorFunctions = require("fitness-calculator");
const myCalorieNeeds = fitnessCalculatorFunctions.calorieNeeds("male",22,176,73,"active");
console.log(`I will eat less than${myCalorieNeeds} to cut down my fat.`)
Functions included (will be updated and maintained)
- BMR (basal metabolic rate)
- BMI (body mass index)
- BFP (body fat percentage)
- idealBodyWeight
- calorieNeeds
- TDEE (Total daily energy expenditure)
- macros
- BAC (blood alcohol content)
API Reference
All measurements are in metric unit (cm, kg) as of now
-
BMR(gender, age, height, weight)
- Parameters (gender ==>
String
, age ==>Number
, height ==>Number
, weight ==>Number
). - All parameters required.
- Returns BMR ==>
Number
. - Gender is not case sensitive.
- Parameters (gender ==>
-
BMI(height, weight)
- Parameters (height ==>
Number
, weight ==>Number
). - All parameters required.
- Returns BMI ==>
Number
. - Gender is not case sensitive.
- Parameters (height ==>
-
BFP(gender, height, weight, neck, waist, hip ==> only required for females)
- Parameters (gender ==>
String
, height ==>Number
, weight ==>Number
, neck ==>Number
, waist ==>Number
, hip ==>Number
). - All parameters required (exception for hip measurement).
- Returns BFP ==>
Number
. (percentage value) - Gender is not case sensitive.
- Parameters (gender ==>
-
idealBodyWeight(gender, height)
- Parameters (gender ==>
String
, height ==>Number
). - All parameters required
- Returns idealBodyWeight ==>
Number
. - Gender is not case sensitive.
- Parameters (gender ==>
-
calorieNeeds(gender, age, height, weight, activity)
- Parameters (gender ==>
String
, age ==>Number
, height ==>Number
, weight ==>Number
, activity ==>String
). - activity is one of the following [
sedentary
,light
,moderate
,active
,extreme
]. - All parameters required.
- Returns calorieNeeds for several cases of goals from [
balance
,mildWeightLoss
,mildWeightGain
,heavyWeightLoss
,heavyWeightGain
] ==>Object
.
{ balance: Number, mildWeightLoss: Number, mildWeightGain: Number, heavyWeightLoss: Number, heavyWeightGain: Number }
- Gender, activity are not case sensitive.
- Parameters (gender ==>
-
TDEE(gender, age, height, weight, activity)
- Parameters (gender ==>
String
, age ==>Number
, height ==>Number
, weight ==>Number
, activity ==>String
). - activity is one of the following [
sedentary
,light
,moderate
,active
,extreme
]. - All parameters required.
- Returns TDEE for balanced goal ==>
Number
. - Gender, activity are not case sensitive.
- Parameters (gender ==>
-
macros(gender, age, height, weight, activity, goal)
- Parameters (gender ==>
String
, age ==>Number
, height ==>Number
, weight ==>Number
, activity ==>String
, goal ==>String
). -
Activity is one of the following [
sedentary
,light
,moderate
,active
,extreme
]. -
Goal is one of the following [
balance
,mildWeightLoss
,mildWeightGain
,heavyWeightLoss
,heavyWeightGain
] - All parameters required.
- Returns macros for several cases of diet-plans from [
balancedDietPlan
,lowCarbDietPlan
,highCarbDietPlan
,highProteinDietPlan
,lowFatDietPlan
,lowSugarDietPlan
] ==>Object
.
{ balancedDietPlan : { carb: `Number`, protein: `Number`, fat: `Number`, sugar: `Number`, }, lowCarbDietPlan : { carb: `Number`, protein: `Number`, fat: `Number`, sugar: `Number`, }, highCarbDietPlan : { carb: `Number`, protein: `Number`, fat: `Number`, sugar: `Number`, }, highProteinDietPlan : { carb: `Number`, protein: `Number`, fat: `Number`, sugar: `Number`, }, lowFatDietPlan : { carb: `Number`, protein: `Number`, fat: `Number`, sugar: `Number`, }, lowSugarDietPlan : { carb: `Number`, protein: `Number`, fat: `Number`, sugar: `Number`, } }
- Gender, activity, goal are not case sensitive.
- Parameters (gender ==>
-
BAC(gender, weight, timeSinceLastDrink ==> In hours, consumptionData)
- Parameters (gender ==>
String
, weight ==>Number
, timeSinceLastDrink ==>Number
, consumptionData ==>Object
). -
consumptionData is required in the following format ==>
Object
{ beer: `Amount in ml` ==> Number, wine: `Amount in ml` ==> Number, liquor: `Amount in ml` ==> Number, other: [`Amount in ml` ==> Number,`strength of alcohol` ==> Number], }
example
{ beer: 650, wine: 200, liquor: 60, other: [30, 14], }
- All parameters required.
- Returns BAC (%) ==>
Number
. - Gender is not case sensitive.
- Parameters (gender ==>