Files
web/utils/numberFormatting.ts
2024-11-25 11:52:43 +01:00

9 lines
248 B
TypeScript

/**
* Function to parse number with single decimal if any
* @param n
* @returns number in float type with single digit decimal if any
*/
export default function getSingleDecimal(n: Number | string) {
return parseFloat(Number(n).toFixed(1))
}