bmi-utils
Version:
An library with some functions relates to Body Mass Index (BMI), like calculate and get the ideial weight
19 lines (16 loc) • 334 B
JavaScript
import tableCategories from './bmi-table'
/**
* @method loadIndex
* @param {String} genre
* @return {Function}
*/
const loadIndex = genre => weight => {
return tableCategories[ genre ]
.reduce((acc, fn, index) => {
if (fn(weight)) {
acc = index
}
return acc
}, 0)
}
export default loadIndex