fitness-calculator

1.1.0 • Public • Published

GitHub license Open Source? Yes! Maintenance

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

  1. Install the package using npm i fitness-calculator
  2. Require the package in your Node application using const fitnessCalculatorFunctions = require("fitness-calculator").
  3. 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)

  1. BMR (basal metabolic rate)
  2. BMI (body mass index)
  3. BFP (body fat percentage)
  4. idealBodyWeight
  5. calorieNeeds
  6. TDEE (Total daily energy expenditure)
  7. macros
  8. BAC (blood alcohol content)

API Reference

All measurements are in metric unit (cm, kg) as of now

  1. BMR(gender, age, height, weight)

    1. Parameters (gender ==> String, age ==> Number, height ==> Number, weight ==> Number).
    2. All parameters required.
    3. Returns BMR ==> Number.
    4. Gender is not case sensitive.
  2. BMI(height, weight)

    1. Parameters (height ==> Number, weight ==> Number).
    2. All parameters required.
    3. Returns BMI ==> Number.
    4. Gender is not case sensitive.
  3. BFP(gender, height, weight, neck, waist, hip ==> only required for females)

    1. Parameters (gender ==> String, height ==> Number, weight ==> Number, neck ==> Number, waist ==> Number, hip ==> Number).
    2. All parameters required (exception for hip measurement).
    3. Returns BFP ==> Number. (percentage value)
    4. Gender is not case sensitive.
  4. idealBodyWeight(gender, height)

    1. Parameters (gender ==> String, height ==> Number).
    2. All parameters required
    3. Returns idealBodyWeight ==> Number.
    4. Gender is not case sensitive.
  5. calorieNeeds(gender, age, height, weight, activity)

    1. Parameters (gender ==> String, age ==> Number, height ==> Number, weight ==> Number, activity ==> String).
    2. activity is one of the following [sedentary, light, moderate, active, extreme].
    3. All parameters required.
    4. Returns calorieNeeds for several cases of goals from [balance, mildWeightLoss, mildWeightGain, heavyWeightLoss, heavyWeightGain] ==> Object.
        {
        balance: Number,
        mildWeightLoss: Number,
        mildWeightGain: Number,
        heavyWeightLoss: Number,
        heavyWeightGain: Number
        }
    1. Gender, activity are not case sensitive.
  6. TDEE(gender, age, height, weight, activity)

    1. Parameters (gender ==> String, age ==> Number, height ==> Number, weight ==> Number, activity ==> String).
    2. activity is one of the following [sedentary, light, moderate, active, extreme].
    3. All parameters required.
    4. Returns TDEE for balanced goal ==> Number.
    5. Gender, activity are not case sensitive.
  7. macros(gender, age, height, weight, activity, goal)

    1. Parameters (gender ==> String, age ==> Number, height ==> Number, weight ==> Number, activity ==> String, goal ==> String).
    2. Activity is one of the following [sedentary, light, moderate, active, extreme].
    3. Goal is one of the following [balance, mildWeightLoss, mildWeightGain, heavyWeightLoss, heavyWeightGain]
    4. All parameters required.
    5. 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`,
        }
        }
    1. Gender, activity, goal are not case sensitive.
  8. BAC(gender, weight, timeSinceLastDrink ==> In hours, consumptionData)

    1. Parameters (gender ==> String, weight ==> Number, timeSinceLastDrink ==> Number, consumptionData ==> Object).
    2. 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],
        }
    1. All parameters required.
    2. Returns BAC (%) ==> Number.
    3. Gender is not case sensitive.

Please raise github issues for improvements/ suggestions/ fixes/ feature requests/ collaboration.

Source code on github

MIT License

Install

npm i fitness-calculator

DownloadsWeekly Downloads

23

Version

1.1.0

License

MIT

Unpacked Size

19.8 kB

Total Files

4

Last publish

Collaborators

  • tripathimanas