1
0

shim.js 269 B

12345678910111213
  1. 'use strict';
  2. var floor = Math.floor;
  3. module.exports = function (x) {
  4. if (isNaN(x)) return NaN;
  5. x = Number(x);
  6. if (x === 0) return x;
  7. if (x === Infinity) return Infinity;
  8. if (x === -Infinity) return -Infinity;
  9. if (x > 0) return floor(x);
  10. return -floor(-x);
  11. };