Consider the following scenario:
oldArray = [
{ id: 1, position: 'DEV OM'},
{ id: 2, position: 'Senior Developer'},
]
newArray = [
{ id: 2, position: 'Senior Developer'},
{ id: 3, position: 'Junior Developer'},
]
How can we identify the items that were added and removed from these arrays?
addedItems = getAddedItems(oldArray, newArray)
removedItems = getRemovedItems(oldArray, newArray)
// AddedItems
[
{ id: 3, position: 'Junior Developer'}
]
// RemovedItems
[
{ id: 1, position: 'DEV OM'}
]
This process is being implemented in a typescript/angular2 application