aboutsummaryrefslogtreecommitdiff
path: root/node_modules/core-js/library/modules/_math-scale.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/core-js/library/modules/_math-scale.js')
-rw-r--r--node_modules/core-js/library/modules/_math-scale.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/node_modules/core-js/library/modules/_math-scale.js b/node_modules/core-js/library/modules/_math-scale.js
new file mode 100644
index 00000000..ba3cdb20
--- /dev/null
+++ b/node_modules/core-js/library/modules/_math-scale.js
@@ -0,0 +1,18 @@
+// https://rwaldron.github.io/proposal-math-extensions/
+module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) {
+ if (
+ arguments.length === 0
+ // eslint-disable-next-line no-self-compare
+ || x != x
+ // eslint-disable-next-line no-self-compare
+ || inLow != inLow
+ // eslint-disable-next-line no-self-compare
+ || inHigh != inHigh
+ // eslint-disable-next-line no-self-compare
+ || outLow != outLow
+ // eslint-disable-next-line no-self-compare
+ || outHigh != outHigh
+ ) return NaN;
+ if (x === Infinity || x === -Infinity) return x;
+ return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow;
+};