@antv/util
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -0,1 +1,3 @@ | ||
var isNumberEqual = require('./is-number-equal'); | ||
module.exports = { | ||
@@ -8,3 +10,3 @@ clamp: require('./clamp'), | ||
isNegative: require('./is-negative'), | ||
isNumberEqual: require('./is-number-equal'), | ||
isNumberEqual: isNumberEqual, | ||
isOdd: require('./is-odd'), | ||
@@ -15,2 +17,3 @@ isPositive: require('./is-positive'), | ||
mod: require('./mod'), | ||
snapEqual: isNumberEqual, | ||
toDegree: require('./to-degree'), | ||
@@ -17,0 +20,0 @@ toInt: require('./to-integer'), |
var PRECISION = 0.00001; // numbers less than this is considered as 0 | ||
var isNumberEqual = function isNumberEqual(a, b) { | ||
return Math.abs(a - b) < PRECISION; | ||
}; | ||
module.exports = function isNumberEqual(a, b) { | ||
var precision = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : PRECISION; | ||
module.exports = isNumberEqual; | ||
return Math.abs(a - b) < precision; | ||
}; |
{ | ||
"name": "@antv/util", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "A common util collection for antv projects", | ||
@@ -5,0 +5,0 @@ "main": "build/util.js", |
@@ -0,1 +1,3 @@ | ||
const isNumberEqual = require('./is-number-equal'); | ||
module.exports = { | ||
@@ -8,3 +10,3 @@ clamp: require('./clamp'), | ||
isNegative: require('./is-negative'), | ||
isNumberEqual: require('./is-number-equal'), | ||
isNumberEqual, | ||
isOdd: require('./is-odd'), | ||
@@ -15,2 +17,3 @@ isPositive: require('./is-positive'), | ||
mod: require('./mod'), | ||
snapEqual: isNumberEqual, | ||
toDegree: require('./to-degree'), | ||
@@ -17,0 +20,0 @@ toInt: require('./to-integer'), |
const PRECISION = 0.00001; // numbers less than this is considered as 0 | ||
const isNumberEqual = function(a, b) { | ||
return Math.abs((a - b)) < PRECISION; | ||
module.exports = function isNumberEqual(a, b, precision = PRECISION) { | ||
return Math.abs((a - b)) < precision; | ||
}; | ||
module.exports = isNumberEqual; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
285255
8811