code: 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;
  }
docs: Gets the byte-length of the value encoded in the given buffer at
  the given index.