bmi-utils
Version:
An library with some functions relates to Body Mass Index (BMI), like calculate and get the ideial weight
19 lines (15 loc) • 336 B
JavaScript
import { lte } from '../utils/helpers'
/**
* @method imcCalc
* @param {Number} heigth
* @param {Number} weight
* @return {Number}
*/
const imcCalc = (weight, heigth) => {
if (lte(weight, 0) || lte(heigth, 0)) {
return 0
}
const result = weight / (heigth * heigth)
return result.toFixed(2)
}
export default imcCalc