You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
411 B
22 lines
411 B
function hasDifferentItemsOrOrder(prevItems, currentItems, idProp = 'id') {
|
|
if (prevItems === currentItems) {
|
|
return false;
|
|
}
|
|
|
|
const len = prevItems.length;
|
|
|
|
if (len !== currentItems.length) {
|
|
return true;
|
|
}
|
|
|
|
for (let i = 0; i < len; i++) {
|
|
if (prevItems[i][idProp] !== currentItems[i][idProp]) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
export default hasDifferentItemsOrOrder;
|