Remap or Map function in Javascript

Here's an implementation of the Processing Math convenience methods in Javascript. It's a straight conversion of the original Processing Java source.

p5.sq()
p5.constrain()
p5.degrees()
p5.mag()
p5.dist()
p5.lerp()
p5.norm()
p5.map()

Get the code from here: https://github.com/trembl/p5.Math.js/


The function below produces the same behaviour as the original Processing function:

function map_range(value, low1, high1, low2, high2) {
    return low2 + (high2 - low2) * (value - low1) / (high1 - low1);
}