es.math.trunc.js 268 B

123456789101112
  1. var $ = require('../internals/export');
  2. var ceil = Math.ceil;
  3. var floor = Math.floor;
  4. // `Math.trunc` method
  5. // https://tc39.es/ecma262/#sec-math.trunc
  6. $({ target: 'Math', stat: true }, {
  7. trunc: function trunc(it) {
  8. return (it > 0 ? floor : ceil)(it);
  9. }
  10. });