shim.js 313B

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