1 // `Math.scale` method implementation
2 // https://rwaldron.github.io/proposal-math-extensions/
3 module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) {
6 /* eslint-disable no-self-compare -- NaN check */
12 /* eslint-enable no-self-compare -- NaN check */
14 if (x === Infinity || x === -Infinity) return x;
15 return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow;