thali/NextGeneration/replication/utilities.js
function compareBufferArrays(buffArray1, buffArray2) {
  assert(Array.isArray(buffArray1), 'We only accept arrays.');
  assert(Array.isArray(buffArray2), 'We only accept arrays.');
  if (buffArray1.length !== buffArray2.length) {
    return false;
  }
  for (var i = 0; i < buffArray1.length; ++i) {
    var buff1 = buffArray1[i];
    assert(Buffer.isBuffer(buff1), 'Only buffers allowed in 1');
    var buff2 = buffArray2[i];
    assert(Buffer.isBuffer(buff2), 'Only buffers allowed in 2');
    if (Buffer.compare(buff1, buff2) !== 0) {
      return false;
    }
  }
  return true;
}
function compareBufferArrays(buffArray1, buffArray2) {
  assert(Array.isArray(buffArray1), 'We only accept arrays.');
  assert(Array.isArray(buffArray2), 'We only accept arrays.');
  if (buffArray1.length !== buffArray2.length) {
    return false;
  }
  for (var i = 0; i < buffArray1.length; ++i) {
    var buff1 = buffArray1[i];
    assert(Buffer.isBuffer(buff1), 'Only buffers allowed in 1');
    var buff2 = buffArray2[i];
    assert(Buffer.isBuffer(buff2), 'Only buffers allowed in 2');
    if (Buffer.compare(buff1, buff2) !== 0) {
      return false;
    }
  }
  return true;
}
function compareBufferArrays ( buffArray1 , buffArray2 ) { assert ( Array . isArray ( buffArray1 ) , 'We only accept arrays.' ) ; assert ( Array . isArray ( buffArray2 ) , 'We only accept arrays.' ) ; if ( buffArray1 . length !== buffArray2 . length ) { return false ; } for ( var i = 0 ; i < buffArray1 . length ; ++ i ) { var buff1 = buffArray1 [ i ] ; assert ( Buffer . isBuffer ( buff1 ) , 'Only buffers allowed in 1' ) ; var buff2 = buffArray2 [ i ] ; assert ( Buffer . isBuffer ( buff2 ) , 'Only buffers allowed in 2' ) ; if ( Buffer . compare ( buff1 , buff2 ) !== 0 ) { return false ; } } return true ; }
Compares if two buffer arrays contain the same buffers in the same order.
@param {Buffer[]} buffArray1
@param {Buffer[]} buffArray2
@returns {boolean}
Compares if two buffer arrays contain the same buffers in the same order .