math-trunc.js 270 B

12345678910
  1. var ceil = Math.ceil;
  2. var floor = Math.floor;
  3. // `Math.trunc` method
  4. // https://tc39.es/ecma262/#sec-math.trunc
  5. // eslint-disable-next-line es/no-math-trunc -- safe
  6. module.exports = Math.trunc || function trunc(x) {
  7. var n = +x;
  8. return (n > 0 ? floor : ceil)(n);
  9. };