UNPKG

bodyfat

Version:

Body fat algorithms

53 lines 2.11 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Durnin = void 0; var Durnin_1 = require("../common/Durnin"); var Durnin = /** @class */ (function (_super) { __extends(Durnin, _super); function Durnin() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param tricep number Tricep skinfold (mm) * @param bicep number Bicep skinfold (mm) * @param subscapular number Subscapular skinfold (mm) * @param suprailiac number Suprailiac skinfold (mm) * @param age number In years * * @returns Body fat percentage */ Durnin.calculate = function (tricep, bicep, subscapular, suprailiac, age) { if (age < 16) { throw new Error("Age should be greater than 16"); } if (age < 20) { return this.getBodyFat(tricep, bicep, subscapular, suprailiac, 1.1549, 0.0678); } else if (age < 30) { return this.getBodyFat(tricep, bicep, subscapular, suprailiac, 1.1599, 0.0717); } else if (age < 40) { return this.getBodyFat(tricep, bicep, subscapular, suprailiac, 1.1423, 0.0632); } else if (age < 50) { return this.getBodyFat(tricep, bicep, subscapular, suprailiac, 1.1333, 0.0612); } return this.getBodyFat(tricep, bicep, subscapular, suprailiac, 1.1339, 0.0645); }; return Durnin; }(Durnin_1.Durnin)); exports.Durnin = Durnin; //# sourceMappingURL=Durnin.js.map