1
0

shim.js 280 B

1234567891011121314
  1. 'use strict';
  2. var log = Math.log, LOG10E = Math.LOG10E;
  3. module.exports = function (x) {
  4. if (isNaN(x)) return NaN;
  5. x = Number(x);
  6. if (x < 0) return NaN;
  7. if (x === 0) return -Infinity;
  8. if (x === 1) return 0;
  9. if (x === Infinity) return Infinity;
  10. return log(x) * LOG10E;
  11. };