packages/leb128/src/leb.js
function encodedLength(encodedBuffer, index) {
  let result = 0;

  while (encodedBuffer[index + result] >= 0x80) {
    result++;
  }

  result++; // to account for the last byte

  if (index + result > encodedBuffer.length) {
    // FIXME(sven): seems to cause false positives
    // throw new Error("integer representation too long");
  }

  return result;
}
function encodedLength(encodedBuffer, index) {
  let result = 0;

  while (encodedBuffer[index + result] >= 0x80) {
    result++;
  }

  result++; // to account for the last byte

  if (index + result > encodedBuffer.length) {
    // FIXME(sven): seems to cause false positives
    // throw new Error("integer representation too long");
  }

  return result;
}
function encodedLength ( encodedBuffer , index ) { let result = 0 ; while ( encodedBuffer [ index + result ] >= 0x80 ) { result ++ ; } result ++ ; // to account for the last byte if ( index + result > encodedBuffer . length ) { // FIXME(sven): seems to cause false positives // throw new Error("integer representation too long"); } return result ; }
Gets the byte-length of the value encoded in the given buffer at
the given index.
Gets the byte - length of the value encoded in the given buffer at the given index .