round-to-step
v1.0.1
Published
Round numbers to a step. Accepts an interval and optional offset.
Readme
roundToStep
Round a number to a step. Accepts an interval and optional offset.
const rounded = roundToStep(45, { offset: 20, interval: 10 })
console.log(rounded) // 50const rounded = roundToStep(45, { offset: 20, interval: 10, direction: 'down' })
console.log(rounded) // 40Options
How to use
npm install round-to-stepimport { roundToStep } from 'round-to-step'