lbry-desktop/ui/util/set-operations.js

16 lines
306 B
JavaScript
Raw Normal View History

2019-10-18 20:01:53 +02:00
export const setDifference = (setA, setB) => {
let _difference = new Set(setA);
for (let el of setB) {
_difference.delete(el);
}
return _difference;
};
export const setUnion = (setA, setB) => {
let _union = new Set(setA);
for (let el of setB) {
_union.add(el);
}
return _union;
};