Front end of the Slack clone application.

123456789101112131415161718
  1. "use strict";
  2. var exp = Math.exp;
  3. module.exports = function (value) {
  4. var num1, num2;
  5. if (isNaN(value)) return NaN;
  6. value = Number(value);
  7. if (value === 0) return value;
  8. if (value === Infinity) return 1;
  9. if (value === -Infinity) return -1;
  10. num1 = exp(value);
  11. if (num1 === Infinity) return 1;
  12. num2 = exp(-value);
  13. if (num2 === Infinity) return -1;
  14. return (num1 - num2) / (num1 + num2);
  15. };