forked from DebaucheryLibrarian/traxxx
24 lines
455 B
JavaScript
24 lines
455 B
JavaScript
|
'use strict';
|
||
|
|
||
|
function feetInchesToCm(feet, inches) {
|
||
|
return Math.round((Number(feet) * 30.48) + (Number(inches) * 2.54));
|
||
|
}
|
||
|
|
||
|
function heightToCm(height) {
|
||
|
const [feet, inches] = height.match(/\d+/g);
|
||
|
|
||
|
return feetInchesToCm(feet, inches);
|
||
|
}
|
||
|
|
||
|
function lbsToKg(lbs) {
|
||
|
const pounds = lbs.toString().match(/\d+/)[0];
|
||
|
|
||
|
return Math.round(Number(pounds) * 0.453592);
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
feetInchesToCm,
|
||
|
heightToCm,
|
||
|
lbsToKg,
|
||
|
};
|