I want to update (replace) the objects in my array with the objects in another array. Each object has the same structure. e.g.
var origArr = [
{name: 'Trump', isRunning: true},
{name: 'Cruz', isRunning: true},
{name: 'Kasich', isRunning: true}
];
var updatingArr = [
{name: 'Cruz', isRunning: false},
{name: 'Kasich', isRunning: false}
];
// desired result:
NEWArr = [
{name: 'Trump', isRunning: true},
{name: 'Cruz', isRunning: false},
{name: 'Kasich', isRunning: false}
];
I've tried concat() & Underscore's _.uniq function, but it always dumps the newer object & returns, essentially, the original array.
Is there a way to overwrite (replace) origArr with the objects in updatingArr -- matching on the name property?