StructureJS
0.15.2A class based utility library for building modular and scalable web platform applications. Features opt-in classes and utilities which provide a solid foundation and toolset to build your next project.
A helper class to do calculations and conversions.
constrain
num
min
max
degreesToRadians
degrees
factorial
num
getDivisors
num
Return an array of divisors of the integer.
num
Number
The number.
isEven
num
isNegative
num
isOdd
num
isPositive
num
isPrime
num
map
num
min1
max1
min2
max2
Re-maps a number from one range to another. The output is the same as inputing the result of rangeToPercent() numbero percentToRange(). Example: num = 10, min1 = 0, max1 = 100, min2 = 0, max2 = 50 // outputs 5
MathUtil.map(10, 0, 100, 0, 50);
// 5
percentToRange
percent
min
max
radiansToDegrees
radians
randomRange
min
max
[wholeNumber=true]
rangeToPercent
num
min
max
constrainMin
constrainMax
Returns the percentage of a number in a given range. Example: num = 15 range 10 to 20 // outputs 0.5
MathUtil.rangeToPercent(15, 10, 20);
// 0.5