to-offset.js 306 B

12345678910
  1. var global = require('../internals/global');
  2. var toPositiveInteger = require('../internals/to-positive-integer');
  3. var RangeError = global.RangeError;
  4. module.exports = function (it, BYTES) {
  5. var offset = toPositiveInteger(it);
  6. if (offset % BYTES) throw RangeError('Wrong offset');
  7. return offset;
  8. };