to-positive-integer.js 291 B

12345678910
  1. 'use strict';
  2. var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
  3. var $RangeError = RangeError;
  4. module.exports = function (it) {
  5. var result = toIntegerOrInfinity(it);
  6. if (result < 0) throw new $RangeError("The argument can't be less than 0");
  7. return result;
  8. };