twenty / packages /twenty-shared /src /utils /array /compareArraysOfObjectsByProperty.ts
Jules
Initial clean CRM deployment with prebuilt assets
d9494a5
Raw
History Blame Contribute Delete
385 Bytes
export const compareArraysOfObjectsByProperty = <T, K extends keyof T>(
arrayA: T[],
arrayB: T[],
property: K,
) => {
return (
arrayA.length !== arrayB.length ||
arrayA.some(
(item) => !arrayB.some((itemB) => itemB[property] === item[property]),
) ||
arrayB.some(
(item) => !arrayA.some((itemA) => itemA[property] === item[property]),
)
);
};