Package Exports
- @keyurbuha/bmi-calc
- @keyurbuha/bmi-calc/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@keyurbuha/bmi-calc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@keyurbuha/bmi-calc
A comprehensive Node.js package for calculating Body Mass Index (BMI) and generating detailed health insights.
๐ Features
Precise BMI Calculation: Calculate Body Mass Index accurately
Comprehensive Health Classification: Categorize BMI results (Underweight, Normal weight, Overweight, Obesity)
Metabolic Insights: Calculate Basal Metabolic Rate (BMR) Determine personalized daily calorie requirements
Weight Management Support: Suggest ideal weight ranges Provide personalized health risk assessments
Lifestyle Recommendations: Generate tailored health and fitness suggestions
๐ฆ Installation
Install the package using your preferred package manager:
npm
npm install @keyurbuha/bmi-calc
Yarn
yarn add @keyurbuha/bmi-calc
pnpm
pnpm add @keyurbuha/bmi-calc
๐ Usage
Basic Example
const { calculateHealthReport } = require('@keyurbuha/bmi-calc');
// Calculate health report
const report = calculateHealthReport(70, 175, 30, 'male', 'moderate');
console.log(report);Input Parameters
The following are the parameters required for the BMI calculation:
weight:- Type: number
- Description: Weight in kilograms
- Valid Values: Positive number
heightCm:- Type: number
- Description: Height in centimeters
- Valid Values: Positive number
age:- Type: number
- Description: User's age
- Valid Values: Positive number
gender:- Type: string
- Description: User's gender
- Valid Values:
"male","female"
activityLevel:- Type: string
- Description: Physical activity level
- Valid Values:
"sedentary","light","moderate","active"
Example Output
"bmi": 22.86,
"classification": "Normal weight",
"bmr": 1668.75,
"dailyCalorieRequirement": 2586.56,
"idealWeightRange": "(63.3 - 73.3 kg)",
"healthRisk": "Low risk",
"recommendation": "Maintain a balanced diet and regular exercise."
}๐ API Reference
calculateHealthReport(weight, heightCm, age, gender, activityLevel)
This function returns a comprehensive health report with the following details:
- bmi: Calculated Body Mass Index
- classification: BMI category (e.g., Underweight, Normal weight, Overweight, Obesity)
- bmr: Basal Metabolic Rate (the number of calories the body needs at rest)
- dailyCalorieRequirement: Recommended daily calorie intake based on activity level
- idealWeightRange: Suggested weight range for the given height
- healthRisk: Potential health risks based on BMI and other factors
- recommendation: Personalized lifestyle suggestions for improving health
๐งช Testing
To run tests, follow these steps:
# Clone the repository
git clone https://github.com/keyurbuha/bmi-calculator-keyur.git
# Navigate to the project directory
cd bmi-calculator-keyur
# Install dependencies
npm install
# Run tests
npm test๐ค Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Create a new Pull Request
๐ License
This project is licensed under the MIT License.
๐ท๏ธ Keywords
- bmi
- health
- fitness
- calculator
- weight-management
๐ค Author
Keyur Buha
๐ Links
- Repository: GitHub Repository
- Issues: Report Issues