1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/frontend/src/utils/arraysHaveSameItems.ts
olav 159c54ed37 fix: resolve issues around changing a toggle's project (#978)
* refactor: show save button before using the dropdown

* refactor: simplify FeatureSettingsProject toast message

* refactor: fix FeatureProjectSelect filter prop type

* refactor: hide change project page for non-enterprise

* refactor: derive move targets from projects list instead of from permissions

* refactor: align frontend project compat check with backend

* refactor: fix useProject object stability

* refactor: disable the save button for the current project

* refactor: require equal environments when moving toggles

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

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);
});
};