summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/lodash/_createRound.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/node_modules/lodash/_createRound.js')
-rw-r--r--tools/node_modules/eslint/node_modules/lodash/_createRound.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/node_modules/eslint/node_modules/lodash/_createRound.js b/tools/node_modules/eslint/node_modules/lodash/_createRound.js
index bf9b713fcb..88be5df396 100644
--- a/tools/node_modules/eslint/node_modules/lodash/_createRound.js
+++ b/tools/node_modules/eslint/node_modules/lodash/_createRound.js
@@ -1,9 +1,11 @@
-var toInteger = require('./toInteger'),
+var root = require('./_root'),
+ toInteger = require('./toInteger'),
toNumber = require('./toNumber'),
toString = require('./toString');
/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeMin = Math.min;
+var nativeIsFinite = root.isFinite,
+ nativeMin = Math.min;
/**
* Creates a function like `_.round`.
@@ -17,7 +19,7 @@ function createRound(methodName) {
return function(number, precision) {
number = toNumber(number);
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
- if (precision) {
+ if (precision && nativeIsFinite(number)) {
// Shift with exponential notation to avoid floating-point issues.
// See [MDN](https://mdn.io/round#Examples) for more details.
var pair = (toString(number) + 'e').split('e'),