Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

round-to

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

round-to - npm Package Compare versions

Comparing version 4.1.0 to 5.0.0

13

index.js

@@ -21,8 +21,5 @@ 'use strict';

let exponent;
[number, exponent] = `${number}e`.split('e');
let result = Math[method](`${number}e${Number(exponent) + precision}`);
const power = 10 ** precision;
[number, exponent] = `${result}e`.split('e');
result = Number(`${number}e${Number(exponent) - precision}`);
let result = Math[method](Number((number * power).toPrecision(15))) / power;

@@ -36,4 +33,4 @@ if (isRoundingAndNegative) {

module.exports = round.bind(null, 'round');
module.exports.up = round.bind(null, 'ceil');
module.exports.down = round.bind(null, 'floor');
module.exports = round.bind(undefined, 'round');
module.exports.up = round.bind(undefined, 'ceil');
module.exports.down = round.bind(undefined, 'floor');
{
"name": "round-to",
"version": "4.1.0",
"version": "5.0.0",
"description": "Round a number to a specific number of decimal places: `1.234` → `1.2`",
"license": "MIT",
"repository": "sindresorhus/round-to",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=10"
},

@@ -34,6 +35,6 @@ "scripts": {

"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^2.4.0",
"tsd": "^0.13.1",
"xo": "^0.34.1"
}
}

@@ -1,6 +0,5 @@

# round-to [![Build Status](https://travis-ci.org/sindresorhus/round-to.svg?branch=master)](https://travis-ci.org/sindresorhus/round-to)
# round-to [![Build Status](https://travis-ci.com/sindresorhus/round-to.svg?branch=master)](https://travis-ci.com/github/sindresorhus/round-to)
> Round a number to a specific number of decimal places: `1.234` → `1.2`
## Install

@@ -12,3 +11,2 @@

## Usage

@@ -65,9 +63,4 @@

Type: `number` (Integer or Infinity)
Type: `number` *(Integer or infinity)*
Number of decimal places.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc