MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / checkOffset

Method checkOffset

projects/JavaScript/proto/fbe.js:6009–6016  ·  view source on GitHub ↗

* Check the buffer offset bounds * @param {!Uint8Array} buffer Buffer * @param {!number} offset Offset * @param {!number} size Size

(buffer, offset, size)

Source from the content-addressed store, hash-verified

6007 * @param {!number} size Size
6008 */
6009 static checkOffset (buffer, offset, size) {
6010 if (((offset % 1) !== 0) || (offset < 0)) {
6011 throw new RangeError('Invalid offset!')
6012 }
6013 if ((offset + size) > buffer.length) {
6014 throw new RangeError('Out of bounds!')
6015 }
6016 }
6017
6018 /**
6019 * Check the value range and its buffer offset bounds

Callers 15

checkValueMethod · 0.95
readUInt32Method · 0.45
readBoolMethod · 0.45
readByteMethod · 0.45
readInt8Method · 0.45
readUInt8Method · 0.45
readInt16Method · 0.45
readUInt16Method · 0.45
readInt32Method · 0.45
readUInt32Method · 0.45
readInt64Method · 0.45
readUInt64Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected