mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-01 00:08:27 +01:00
13 lines
273 B
TypeScript
13 lines
273 B
TypeScript
|
export const arraysHaveSameItems = <T>(a: T[], b: T[]): boolean => {
|
||
|
const setA = new Set(a);
|
||
|
const setB = new Set(b);
|
||
|
|
||
|
if (setA.size !== setB.size) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
return [...setA].every(itemA => {
|
||
|
return setB.has(itemA);
|
||
|
});
|
||
|
};
|