UNPKG

charlike

Version:

Small, fast, simple and streaming project scaffolder for myself, but not only. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options

18 lines (15 loc) 330 B
'use strict'; var exp = Math.exp; module.exports = function (x) { var a, b; if (isNaN(x)) return NaN; x = Number(x); if (x === 0) return x; if (x === Infinity) return 1; if (x === -Infinity) return -1; a = exp(x); if (a === Infinity) return 1; b = exp(-x); if (b === Infinity) return -1; return (a - b) / (a + b); };