source: imaps-frontend/node_modules/core-js/internals/math-scale.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 607 bytes
Line 
1'use strict';
2// `Math.scale` method implementation
3// https://rwaldron.github.io/proposal-math-extensions/
4module.exports = function scale(x, inLow, inHigh, outLow, outHigh) {
5 var nx = +x;
6 var nInLow = +inLow;
7 var nInHigh = +inHigh;
8 var nOutLow = +outLow;
9 var nOutHigh = +outHigh;
10 // eslint-disable-next-line no-self-compare -- NaN check
11 if (nx !== nx || nInLow !== nInLow || nInHigh !== nInHigh || nOutLow !== nOutLow || nOutHigh !== nOutHigh) return NaN;
12 if (nx === Infinity || nx === -Infinity) return nx;
13 return (nx - nInLow) * (nOutHigh - nOutLow) / (nInHigh - nInLow) + nOutLow;
14};
Note: See TracBrowser for help on using the repository browser.