2.0.0 • Published 6 months ago
nutrition-calculator v2.0.0
Nutrition Calculator
This package helps you calculate your Maintenance Calories and Macronutrient breakdown based on your activity level and caloric needs. The package provides an easy-to-use method for determining how many calories you need to maintain your current weight and how to distribute those calories across macronutrients (carbs, proteins, and fats).
Installation
npm install nutrition-calculator
Usage
Here’s how you can use the package to calculate your Maintenance Calories and the breakdown of macronutrients.
Calculate Maintenance Calories
gender
options:male
|female
height
incm
weight
inkg
age
inyears
activity
options:sedentary
,lightActivity
,moderatelyActive
,veryActive
,extraActive
import { calculateMaintenanceCalories, Gender, ActivityFactor } from 'nutrition-calculator';
calculateMaintenanceCalories({ gender: 'male', height: 184, weight: 94.2, age: 32, activity: 'lightActivity' });
// -> 2841
Calculate Macro Nutritions
calories
which the nutrition split is based on- amount of
carbohydrates
in%
- amount of
fat
in%
- amount of
proteins
in%
import { calculateMacroNutritions } from 'nutrition-calculator';
calculateMacroNutritions({ calories: 2841, percentageSplit: { carbohydrates: 50, fat: 30, protein: 20 } });
// -> { carbohydrates: 355, fat: 95, protein: 142 }
Changelog
See Changelog.
License
This package is open-source and available under the MIT License.