Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nutrition

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nutrition

Simple nutrition facts wrapper

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status

Nutrition

Simple nutrition facts wrapper as an NPM module.

Installation

npm install nutrition --save

Usage

// import for ES6
import * as nutrition from 'nutrition'

const opts = {
  weight: 65,
  height: 1.75
}
const value  = nutrition.bmi(opts)


// OR import for ES5
var nutrition = require('nutrition')

var opts = {
  weight: 65,
  height: 1.75
}
var value  = nutrition.bmi(opts)

Methods

bmi(opts)

BMI (Body Mass Index) is a measurement of body fat based on height and weight that applies to both men and women. It can be used to indicate if you are overweight, obese, underweight or normal.

opts is an object with properties containing formula values

The following arguments are expected:

  • weight : Subject weight (default is kilograms)
  • height : Subject height (default is meters)
  • eng :
    • If true then weight is used in pounds, otherwise in kilograms.
    • If true then height is used in inches, otherwise in meters.
bmiClass(bmi)

Returns the class from Body Mass Index value. Possible results are:

  • Underweight, Normal, Overweight, Obese Class 1, Obese Class 2, Morbid Obesity
bmr(opts)

BMR (Basal Metabolic Rate) is the amount of energy expended while at rest in a neutrally temperate environment.

opts is an object with properties containing formula values

The following arguments are expected:

  • weight : Weight in kilograms
  • height : Height in meters
  • age : Age in years
  • woman : True if subject is a woman, False if men. (Default is true)
dailyCalories(opts)

This method also know as the Harris–Benedict equation is a method used to estimate individual's daily kilocalorie requirements based on a basal metabolic rate (BMR).

opts is an object with properties containing formula values

The following arguments are expected:

  • bmr : Float obtained from bmr method
  • exerciseType : Exercise frequency. Use one of the following options:
    • 'No' if little to no exercise
    • 'Light' if light exercise (1-3 days per week)
    • 'Moderate' if medium exercise (3-5 days per week)
    • 'Heavy' if heavy exercise (6-7 days per week)
    • 'Full' if extra heavy exercise (twice per day)

Next steps

  • Set of healthy methods
  • Coverage

Contributing

Please see CONTRIBUTING.

LICENSE

MIT, see LICENSE.

Keywords

FAQs

Package last updated on 16 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc