function diffRecords(localRecords, newRecords) {
  var recordsDiff = {};
  _.each(newRecords, function(record, uid) {
    if (localRecords[uid]) {
      if (localRecords[uid].hash !== record.hash) {
        record.op = "update";
        recordsDiff[uid] = record;
      }
    } else {
      record.op = "update";
      recordsDiff[uid] = record;
    }
  });
  _.each(localRecords, function(record, uid) {
    if (!newRecords[uid]) {
      record.op = "delete";
      recordsDiff[uid] = record;
    }
  });
  return recordsDiff;
}
function diffRecords(localRecords, newRecords) {
  var recordsDiff = {};
  _.each(newRecords, function(record, uid) {
    if (localRecords[uid]) {
      if (localRecords[uid].hash !== record.hash) {
        record.op = "update";
        recordsDiff[uid] = record;
      }
    } else {
      record.op = "update";
      recordsDiff[uid] = record;
    }
  });
  _.each(localRecords, function(record, uid) {
    if (!newRecords[uid]) {
      record.op = "delete";
      recordsDiff[uid] = record;
    }
  });
  return recordsDiff;
}
function diffRecords ( localRecords , newRecords ) { var recordsDiff = { } ; _ . each ( newRecords , function ( record , uid ) { if ( localRecords [ uid ] ) { if ( localRecords [ uid ] . hash !== record . hash ) { record . op = "update" ; recordsDiff [ uid ] = record ; } } else { record . op = "update" ; recordsDiff [ uid ] = record ; } } ) ; _ . each ( localRecords , function ( record , uid ) { if ( ! newRecords [ uid ] ) { record . op = "delete" ; recordsDiff [ uid ] = record ; } } ) ; return recordsDiff ; }
Compute the diff between the 2 objects based on the hash value
@param {Object} localRecords
@param {Object} newRecords
@returns an object that contains the diff
Compute the diff between the 2 objects based on the hash value