Nodejs Utililty Methods Number Value Map

List of utility methods to do Number Value Map

Description

The list of methods to do Number Value Map are organized into topic(s).

Method

map( in_min , in_max , out_min , out_max )
Number.prototype.map = function ( in_min , in_max , out_min , out_max ) {
  return ( this - in_min ) * ( out_max - out_min ) / ( in_max - in_min ) + out_min;
map(in_min, in_max, out_min, out_max)
Number.prototype.map = function (in_min, in_max, out_min, out_max) {
  return (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
Math.radians = function(degrees) {
  return degrees * Math.PI / 180;
};
map(in_min, in_max, out_min, out_max)
Number.prototype.map = function (in_min, in_max, out_min, out_max) {
    return (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
};
map(in_min, in_max, out_min, out_max)
Number.prototype.map = function (in_min, in_max, out_min, out_max) {
  return (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
function convertToRange(value, srcRange, dstRange){
  if (value < srcRange[0] || value > srcRange[1]){
    return NaN; 
  var srcMax = srcRange[1] - srcRange[0],
    dstMax = dstRange[1] - dstRange[0],
...
map(in_min, in_max, out_min, out_max)
Number.prototype.map = function (in_min, in_max, out_min, out_max) {
    return (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
map(istart, istop, ostart, ostop)
Number.prototype.map = function (istart, istop, ostart, ostop) {
    return ostart + (ostop - ostart) * ((this - istart) / (istop - istart));
};
limit(min, max)
Number.prototype.limit = function(min, max) {
    var i = this;
    if (i < min) i = min;
    if (i > max) i = max;
    return i;
};
limit(min, max)
Number.prototype.limit = function (min, max) {
    return Math.min(max, Math.max(min, this));
};