Bookmark this: tool.io/waist-to-height/source-code
Waist-to-height Source Code
Browse the implementation files for Waist-to-height.tool.ts typescript
import { calculateWaistToHeight } from '@tool.io/tools/waist-to-height';
export const waistToHeight = (
waist: number,
height: number
): string => {
const ratio = calculateWaistToHeight(waist, height);
return ratio === null ? '' : ratio.toPrecision(4);
};
// The tool definition.
export const Tool: TypeTool = {
name: 'Waist-to-height',
slug: 'waist-to-height',
intro: 'Calculate your waist-to-height ratio.',
tool: waistToHeight,
i: [
{
example: '80',
label: 'Waist',
placeholder: 'Waist circumference in cm',
type: 'number'
},
{
example: '180',
label: 'Height',
placeholder: 'Height in cm',
type: 'number'
}
],
o: [
{
example: '0.44',
label: 'Waist-to-height',
placeholder: 'Waist-to-height ratio',
render: 'textarea',
type: 'number'
}
],
equation:
'$$ waistToHip(\\text{waist}, \\text{height}) \\rightarrow \\frac{waist}{height}$$',
alternative: [
{
title: 'Waist to hip calculator',
url: '/waist-to-hip'
},
{
title: 'Body mass index calculator',
url: '/body-mass-index'
}
],
cite: [
{
title: 'Waist-to-height ratio - Wikipedia',
url: 'https://en.wikipedia.org/wiki/Waist-to-height_ratio'
}
]
};
export default Tool;
Description
Browse the implementation files for Waist-to-height.