Function scale

Changes the scale of given value, i.e.: replaces values from 2.9 to 3.3 into values from 0 to 100. Useful for i.e.: displaying measured battery voltage as a percent value. Pro-tip: use Function.prototype.bind to create yourself a function with bound 4 first arguments to re-use without repeating the from-to scale.

  • Parameters

    • fromMin: number
    • fromMax: number
    • toMin: number
    • toMax: number
    • number: number

    Returns number