Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
renderRationalNumberWithBoundedDenominator(value) {
// https://github.com/SheetJS/frac
const denominatorDigits = 4;
const maximumDenominator = Math.pow(10, Number(denominatorDigits) || 0) - 1; // 10^4 - 1 = 9999
const [quot, numerator, denominator] = frac(value, maximumDenominator, true);
if (numerator > 0) {
return (
<span>
{quot > 0 ? quot : ''}
</span>
);
}
return (
<span>{quot > 0 ? quot : ''}</span>