round

Round numbers to the nearest increment with an optional direction

  • round

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
round
622.0.19 years ago10 years agoMinified + gzip package size for round in KB

Readme

round.js Build Status
Round numbers to the nearest multiple with an optional direction.

Installing

$ npm install --save round

API

round(value, [multiple], [direction]) -> number

value
Required
Type: number
The value to round.
multiple
Type: number
Default: 1
The multiple to round to.
direction
Type: string
Values: up / down
If no direction is supplied, the number will be rounded to the nearest direction, defaulting to up if the value is equidistant from the rounded values.

round.down(value, multiple) -> number

Convenience method for rounding down.

round.up(value, multiple) -> number

Convenience method for rounding up.