1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/util/arraysHaveSameItems.ts
olav 8c1d4838b8
fix: require equal environments when moving toggles (#1595)
* fix: apply query from checkProjectsCompatibility

* fix: require equal environments when moving toggles

* refactor: clean up project service tests

* refactor: add test for project compatibility check

* refactor: improve arraysHaveSameItems name
2022-05-18 11:07:01 +02:00

13 lines
275 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);
});
};