body-mass-index

1.0.0 • Public • Published

body-mass-index Build Status XO code style

Calculate the body mass index (BMI) with the freedom of multiple units

bodyMassIndex('200 lb', '6ft 9in') => 21.4

Install

$ npm install --save body-mass-index

Usage

Typical Usage

const bodyMassIndex = require('body-mass-index');
bodyMassIndex('200 lb', '6ft 9in');
// => 21.4

Advance Usage

Interchangeable Imperial and Metric Units

const bodyMassIndex = require('body-mass-index');
bodyMassIndex('90.17kg 1lb 100g', '145.27cm 1ft 0.30m');
// => 21.4

API

bodyMassIndex(weight, height [,options])

Weight

Type: string || number

A combination of multiple masses (n units(mc|mg|g|kg|oz|lb)). A sole number input shall cause the function to default to kg.

Height

Type: string || number

A combination of multiple lengths (n units(mm|cm|m|km|in|yd|ft|mi)). A sole number input shall cause the function to default to m.

options

round

Type: number
Default: 1

The decimal place for the returned BMI to be rounded to.

License

MIT © Brandon Him

Package Sidebar

Install

npm i body-mass-index

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • brh55