mirror of
https://github.com/baserow/baserow.git
synced 2026-12-06 01:08:32 +00:00
14 lines
298 B
JavaScript
14 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
|
|
}
|