UNPKG
bea-ui
Version:
latest (0.3.0)
0.3.0
0.2.0
0.1.0
React component library
github.com/craigharvi3/bea
craigharvi3/bea
bea-ui
/
components
/
utils
/
rounding.js
8 lines
(6 loc)
•
224 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
export
const
limitToBounds
= (
x, max, min =
0
) => {
return
Math
.
min
(
Math
.
max
(x, min), max); };
export
const
roundToNearestMultiple
= (
value, multiple
) => {
return
Math
.
round
(multiple *
Math
.
round
(value / multiple)); };