(step)
| 3 | |
| 4 | const clamp = (val, min, max) => Math.min(Math.max(val, min), max); |
| 5 | const stepDecimals = (step) => { |
| 6 | const s = step.toString(); |
| 7 | const dot = s.indexOf('.'); |
| 8 | return dot === -1 ? 0 : s.length - dot - 1; |
| 9 | }; |
| 10 | const roundToStep = (val, step, min) => { |
| 11 | const raw = Math.round((val - min) / step) * step + min; |
| 12 | const decimals = Math.max(stepDecimals(step), stepDecimals(min)); |
no outgoing calls
no test coverage detected