round
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/round package

2.0.1 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.1
    31,078
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.1
    31,078
  • 2.0.0
    1
  • 1.0.1
    2
  • 1.0.0
    1

Package Sidebar

Install

npm i round

Weekly Downloads

31,082

Version

2.0.1

License

MIT

Last publish

Collaborators

  • bendrucker