Given two lists of the same type, iterate the first list and replace items matched by the matcher func in the first place.
const gods = [ { name: 'Zeus', power: 92 }, { name: 'Ra', power: 97 }]const newGods = [ { name: 'Zeus', power: 100 }]mergeBy(gods, newGods, f => f.name) // => [{name: "Zeus" power: 100}, {name: "Ra", power: 97}] Copy
const gods = [ { name: 'Zeus', power: 92 }, { name: 'Ra', power: 97 }]const newGods = [ { name: 'Zeus', power: 100 }]mergeBy(gods, newGods, f => f.name) // => [{name: "Zeus" power: 100}, {name: "Ra", power: 97}]
Description
Given two lists of the same type, iterate the first list and replace items matched by the matcher func in the first place.
Example