1.0.1 • Published 2 years ago

round-to-step v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

roundToStep

Round a number to a step. Accepts an interval and optional offset.

const rounded = roundToStep(45, { offset: 20, interval: 10 })
console.log(rounded) // 50
const rounded = roundToStep(45, { offset: 20, interval: 10, direction: 'down' })
console.log(rounded) // 40

Options

How to use

npm install round-to-step
import { roundToStep } from 'round-to-step'
1.0.1

2 years ago

1.0.0

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago