Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>pull/2/head
parent
824d315a3b
commit
f3d7852ec4
@ -0,0 +1,15 @@
|
||||
function getRemovedItems(prevItems, currentItems, idProp = 'id') {
|
||||
if (prevItems === currentItems) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const currentItemIds = new Set();
|
||||
|
||||
currentItems.forEach((currentItem) => {
|
||||
currentItemIds.add(currentItem[idProp]);
|
||||
});
|
||||
|
||||
return prevItems.filter((prevItem) => !currentItemIds.has(prevItem[idProp]));
|
||||
}
|
||||
|
||||
export default getRemovedItems;
|
Loading…
Reference in new issue