lib/encoder.js
function getLengthBufferV2(value) {
  if (!value) {
    return buffers.int16Zero;
  }
  const lengthBuffer = utils.allocBufferUnsafe(2);
  if (typeof value === 'number') {
    lengthBuffer.writeUInt16BE(value, 0);
  }
  else {
    lengthBuffer.writeUInt16BE(value.length, 0);
  }
  return lengthBuffer;
}
function getLengthBufferV2(value) {
  if (!value) {
    return buffers.int16Zero;
  }
  const lengthBuffer = utils.allocBufferUnsafe(2);
  if (typeof value === 'number') {
    lengthBuffer.writeUInt16BE(value, 0);
  }
  else {
    lengthBuffer.writeUInt16BE(value.length, 0);
  }
  return lengthBuffer;
}
function getLengthBufferV2 ( value ) { if ( ! value ) { return buffers . int16Zero ; } const lengthBuffer = utils . allocBufferUnsafe ( 2 ) ; if ( typeof value === 'number' ) { lengthBuffer . writeUInt16BE ( value , 0 ) ; } else { lengthBuffer . writeUInt16BE ( value . length , 0 ) ; } return lengthBuffer ; }
Gets a buffer containing with the bytes (BE) representing the collection length for protocol v2 and below
@param {Buffer|Number} value
@returns {Buffer}
@private
Gets a buffer containing with the bytes ( BE ) representing the collection length for protocol v2 and below