Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

round10

jhohlfeld22.1kCC-BY-SA-2.51.0.3

Brings decimal adjustment to the Math object.

round, round10, mdn, Math, Math.round, precision, decimal, adjustment

readme

Inspired by Decimal rounding polyfill by MDN.

Installation

Install using npm:

$ npm install round10

Usage

Use in your project:

$ npm install --save round10

and in your code:

var round10 = require('round10').round10;
round10(55.55, -1); // 55.6

Optionally, you may use the polyfill which extends the global Math object:

require('round10').polyfill();
Math.round10(55.55, -1); // 55.6

Check out the code

$ git clone git@github.com:jhohlfeld/round10.git
$ cd round10
$ npm install

Test using mocha:

$ npm install -g mocha
$ mocha test/test.js