src/helpers.js
function assertOffset(offset, min, cap, size) {
    if (typeof offset !== 'number' || offset % 1 !== 0)
        throw TypeError("Illegal offset: "+offset+" (not an integer)");
    offset = offset | 0;
    if (offset < min || offset > cap-size)
        throw RangeError("Illegal offset: "+min+" <= "+value+" <= "+cap+"-"+size);
    return offset;
}
function assertOffset(offset, min, cap, size) {
    if (typeof offset !== 'number' || offset % 1 !== 0)
        throw TypeError("Illegal offset: "+offset+" (not an integer)");
    offset = offset | 0;
    if (offset < min || offset > cap-size)
        throw RangeError("Illegal offset: "+min+" <= "+value+" <= "+cap+"-"+size);
    return offset;
}
function assertOffset ( offset , min , cap , size ) { if ( typeof offset !== 'number' || offset % 1 !== 0 ) throw TypeError ( "Illegal offset: " + offset + " (not an integer)" ) ; offset = offset | 0 ; if ( offset < min || offset > cap - size ) throw RangeError ( "Illegal offset: " + min + " <= " + value + " <= " + cap + "-" + size ) ; return offset ; }
Asserts that `min <= offset <= cap-size` and returns the type-safe offset.
@param {number} offset Offset to assert
@param {number} min Minimum offset
@param {number} cap Cap offset
@param {number} size Required size in bytes
@returns {number} Type-safe offset
@throws {TypeError} If `offset` is not an integer
@throws {RangeError} If `offset < min || offset > cap-size`
@inner
Asserts that min < = offset < = cap - size and returns the type - safe offset .