Comparing version 0.1.1 to 0.2.0
13
index.js
@@ -7,6 +7,8 @@ /** | ||
module.exports = { | ||
between: decorate(between), | ||
isBetween: decorate(isBetween), | ||
toPrecision: decorate(toPrecision), | ||
getPrecision: decorate(getPrecision) | ||
between: wrap(between), | ||
isBetween: wrap(isBetween), | ||
toPrecision: wrap(toPrecision), | ||
getPrecision: getPrecision, | ||
min: wrap(Math.min), | ||
max: wrap(Math.max) | ||
}; | ||
@@ -20,3 +22,3 @@ | ||
*/ | ||
function decorate(fn){ | ||
function wrap(fn){ | ||
return function(a){ | ||
@@ -89,2 +91,3 @@ var args = arguments; | ||
/** | ||
@@ -91,0 +94,0 @@ * Precision round |
{ | ||
"name": "mumath", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Micro math methods: isBetween, between, getPrecition, toPrecision", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,1 +0,8 @@ | ||
Some common math operations generalized to objects/arrays | ||
Common math functions extended to objects/arrays. | ||
* `min(a,b)` | ||
* `max(a,b)` | ||
* `between(a,min,max)` | ||
* `isBetween(a,min,max)` | ||
* `toPrecision()` | ||
* `getPrecision()` |
var m = require('../index'); | ||
var assert = require('assert'); | ||
assert.equal(m.min(0,2),0); | ||
assert.equal(m.max(0,2),2); | ||
assert.deepEqual(m.min([0,0],[2,-2]),[0,-2]); | ||
assert.equal(m.between(-100, 0, 100), 0); | ||
@@ -5,0 +9,0 @@ assert.equal(m.between(-100, 100, 0), 0); |
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
3775
123
8