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

nutrition

v1.3.2

Published

Simple nutrition facts wrapper

Downloads

49

Readme

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.