Comparing version 0.3.1 to 0.4.0
@@ -12,4 +12,4 @@ /** | ||
module.exports = function(a, min, max){ | ||
module.exports = require('./wrap')(function(a, min, max){ | ||
return max > min ? Math.max(Math.min(a,max),min) : Math.max(Math.min(a,min),max); | ||
}; | ||
}); |
@@ -9,6 +9,6 @@ var wrap = require('./wrap'); | ||
module.exports = { | ||
between: wrap(require('./between')), | ||
isBetween: wrap(require('./is-between')), | ||
round: wrap(require('./round')), | ||
getPrecision: require('./get-precision'), | ||
between: require('./between'), | ||
isBetween: require('./is-between'), | ||
round: require('./round'), | ||
precision: require('./precision'), | ||
min: wrap(Math.min), | ||
@@ -15,0 +15,0 @@ max: wrap(Math.max), |
@@ -10,5 +10,5 @@ /** | ||
*/ | ||
module.exports = function(a, left, right){ | ||
module.exports = require('./wrap')(function(a, left, right){ | ||
if (a <= right && a >= left) return true; | ||
return false; | ||
}; | ||
}); |
{ | ||
"name": "mumath", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "Micro math methods: isBetween, between, getPrecition, toPrecision", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,3 +15,3 @@ /** | ||
module.exports = function(value, step) { | ||
module.exports = require('./wrap')(function(value, step) { | ||
if (step === 0) return value; | ||
@@ -21,3 +21,3 @@ if (!step) return Math.round(value); | ||
value = Math.round(value / step) * step; | ||
return parseFloat(value.toFixed(getPrecision(step))); | ||
}; | ||
return parseFloat(value.toFixed(require('./precision')(step))); | ||
}); |
@@ -21,2 +21,6 @@ var m = require('../index'); | ||
assert.deepEqual(m.sub({top:10,bottom:20}, {top:5, bottom:5}), {top:5, bottom:15}); | ||
assert.deepEqual(m.add({top:10, bottom:20}, {top:5, bottom:5}), {top:15, bottom:25}); | ||
assert.deepEqual(m.add({top:10, bottom:20}, {top:5, bottom:5}), {top:15, bottom:25}); | ||
//precisions | ||
assert.equal(m.precision(0.02), 2); | ||
assert.equal(m.round(0.3, .5), .5); |
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
4689
134