I have two arrays of objects that represent email addresses that have a label and a value:
var original = [
{
label: \'private\',
value: \'private@
In case you are using lodash 3.x where _.unionBy() was not there, you can combine _.union() and _.uniq() to get the same result.
var original = [
{ label: 'private', value: 'private@johndoe.com' },
{ label: 'work', value: 'work@johndoe.com' }
];
var update = [
{ label: 'private', value: 'me@johndoe.com' },
{ label: 'school', value: 'schol@johndoe.com' }
];
var result = _.uniq(_.union(update, original), "label");
console.log(result);