JavaScript Scal tablice obiektów bez duplikatów
var merged = [...initialData, ...newData.filter(d => !ids.has(d.ID))];
Repulsive Rhinoceros
var merged = [...initialData, ...newData.filter(d => !ids.has(d.ID))];
// Join Without Dupes.
const joinWithoutDupes = (A, B) => {
const a = new Set(A.map(x => x.item))
const b = new Set(B.map(x => x.item))
return [...A.filter(x => !b.has(x.item)), ...B.filter(x => !a.has(x.item))]
}
// Proof.
const output = joinWithoutDupes([{item:"apple",description: "lorem"},{item:"peach",description: "impsum"}], [{item:"apple", description: "dolor"},{item:"grape", description: "enum"}])
console.log(output)