UNPKG

@amberflo-test/ui-kit-test

Version:

Test-Amberflo UI Kit

11 lines (7 loc) 284 B
export const addZeroAfterDecimal = (number) => { const string = number.toString(); const decimals = string.split(".")[1]; const length = decimals && decimals.length > 2 ? decimals.length : 2; const fixedNumber = parseFloat(number).toFixed(length); return fixedNumber; };