1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-05-20 15:39:35 +00:00
bramw_baserow/web-frontend/modules/core/utils/number.js
2020-03-31 14:15:27 +00:00

13 lines
298 B
JavaScript

export const rounder = (digits) => {
return parseInt('1' + Array(digits + 1).join('0'))
}
export const floor = (n, digits = 0) => {
const r = rounder(digits)
return Math.floor(n * r) / r
}
export const ceil = (n, digits = 0) => {
const r = rounder(digits)
return Math.ceil(n * r) / r
}