# round

> Round numbers to the nearest increment with an optional direction

Latest version **2.0.1** (published 2015-08-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install round
pnpm add round
yarn add round
bun add round
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2015-08-17 |
| First published | 2014-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/round) |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Ben Drucker |
| Maintainers | bendrucker |
| Keywords | numbers, round, increment |

## Links

- npm: https://www.npmjs.com/package/round
- Repository: https://github.com/bendrucker/round.js
- Issues: https://github.com/bendrucker/round.js/issues
- npm.io page: https://npm.io/package/round

## Dependencies (2)

- [precision](https://npm.io/package/precision.md) ~1.0.0
- [round-precision](https://npm.io/package/round-precision.md) ~1.0.0

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2015-08-17
- 2.0.0 — 2015-06-09
- 1.0.1 — 2014-11-10
- 1.0.0 — 2014-11-09

## README

round.js [![Build Status](https://travis-ci.org/bendrucker/round.js.svg?branch=master)](https://travis-ci.org/bendrucker/round.js)
========

> Round numbers to the nearest multiple with an optional direction.

## Installing

```js
$ 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.

---
_Source: https://npm.io/package/round · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
