Given:
- array of "current" objects
[{id: '1'},{id: '2'},{id: '3'},{id: '4'},{id: '5'}] - array of "new" objects
[{id: '1'},{id: '5'},{id: '6'},{id: '7'},{id: '8'}]
How to determine which objects
- to add (not in "current") and
- to remove (not in "new")?
In this case:
{id: '2'},{id: '3'},{id: '4'}should be removed{id: '6'},{id: '7'},{id: '8'}should be added
Performance is not extremely important, my dataset is usually around 200.
Edit: I need to know about elements to be added/removed because "current" array correlates to DOM nodes and I don't just want to delete them all and add from scratch - already tried that and performance is far from perfect.