Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brh55/body-mass-index
:muscle: Calculate the body mass index (BMI) with the freedom of multiple units
https://github.com/brh55/body-mass-index
Last synced: 30 days ago
JSON representation
:muscle: Calculate the body mass index (BMI) with the freedom of multiple units
- Host: GitHub
- URL: https://github.com/brh55/body-mass-index
- Owner: brh55
- License: mit
- Created: 2017-01-27T02:37:06.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-06T10:26:52.000Z (almost 8 years ago)
- Last Synced: 2024-10-05T07:09:24.557Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# body-mass-index [![Build Status](https://img.shields.io/travis/brh55/body-mass-index.svg?style=flat-square)](https://travis-ci.org/brh55/body-mass-index) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=flat-square)](https://github.com/sindresorhus/xo)
> 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
```js
const bodyMassIndex = require('body-mass-index');
bodyMassIndex('200 lb', '6ft 9in');
// => 21.4
```#### Advance Usage
Interchangeable Imperial and Metric Units
```js
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](https://github.com/brh55/body-mass-index)