function merge(source1, source2, omittedFields) {
return lodash.zipWith(table1, table2, function(previous, next) {
if(previous.Oid === next.array_ref) {
var nextWithoutId = lodash.omit.apply(null, [next].concat(omittedFields));
return lodash.assign(previous, nextWithoutId);
}
});
}
const zipped = merge(table1, table2, ['array_ref', 'id']);