Package Exports
- mumath
- mumath/add
- mumath/between
- mumath/is-between
- mumath/loop
- mumath/mod
- mumath/precision
- mumath/round
- mumath/sub
- mumath/wrap
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mumath) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
μMath

Set of practical math utils to shorten code.
$ npm install mumath
var round = require('mumath/round');
round(123.32, .5); //123.5
//require any function as
//var <fn> = require('mumath/<fn>');
API
round(value, precision?)
Rounds value to optional precision
, which is 1
by default.
precision(value)
Get precision from float:
1.1 → 1, 1234 → 0, .1234 → 4
between(value, left, right)
Return value clamped by left/right limits (or vice-versa).
isBetween(value, left, right)
Whether element is between left & right, including.
loop(value, [min,]? max)
An enhanced mod-loop - loops value within a frame.
mult(a, b, ...)
div(a, b, ...)
sub(a, b, ...)
add(a, b, ...)
mod(a, b, ...)
min(a, b, ...)
max(a, b, ...)
floor(a, b, ...)
ceil(a, b, ...)
Simple wrappers for arythmetical functions.
gt(a,b)
gte(a,b)
lt(a,b)
lte(a,b)
eq(a,b)
ne(a,b)
Simple conditional functions.