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 🙏

© 2024 – Pkg Stats / Ryan Hefner

fitness-calculator

v1.1.1

Published

This is a package which will help you perform calculations for your calorie needs, total daily energy expenditure, macros and much more

Downloads

35

Readme

GitHub license Open Source? Yes! Maintenance GitHub stars

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