massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / internals / math-scale.js
index c1a76eb4bc28bf441261baa29a436c3c1238f641..ceb3c21c8cfaef404955482671c9573e4a83a4e4 100644 (file)
@@ -1,16 +1,13 @@
 // `Math.scale` method implementation
 // https://rwaldron.github.io/proposal-math-extensions/
 module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) {
-  if (
-    arguments.length === 0
-      /* eslint-disable no-self-compare -- NaN check */
-      || x != x
-      || inLow != inLow
-      || inHigh != inHigh
-      || outLow != outLow
-      || outHigh != outHigh
-      /* eslint-enable no-self-compare -- NaN check */
-  ) return NaN;
-  if (x === Infinity || x === -Infinity) return x;
-  return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow;
+  var nx = +x;
+  var nInLow = +inLow;
+  var nInHigh = +inHigh;
+  var nOutLow = +outLow;
+  var nOutHigh = +outHigh;
+  // eslint-disable-next-line no-self-compare -- NaN check
+  if (nx != nx || nInLow != nInLow || nInHigh != nInHigh || nOutLow != nOutLow || nOutHigh != nOutHigh) return NaN;
+  if (nx === Infinity || nx === -Infinity) return nx;
+  return (nx - nInLow) * (nOutHigh - nOutLow) / (nInHigh - nInLow) + nOutLow;
 };