to-integer.js 249 B

12345678
  1. var ceil = Math.ceil;
  2. var floor = Math.floor;
  3. // `ToInteger` abstract operation
  4. // https://tc39.es/ecma262/#sec-tointeger
  5. module.exports = function (argument) {
  6. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  7. };