getNumber.js
468 Bytes
export const roundUp = (number = 0.00, decimal = 2) => {
return Math.ceil((number * Math.pow(10, decimal)).toPrecision(15)) / Math.pow(10, decimal);
}
export const roundTo = (number = 0.00, decimal = 2) => {
return Math.round((number * Math.pow(10, decimal)).toPrecision(15)) / Math.pow(10, decimal);
}
export const roundDown = (number = 0.00, decimal = 2) => {
return Math.floor((number * Math.pow(10, decimal)).toPrecision(15)) / Math.pow(10, decimal);
}