jsii
Version:
[](https://cdk.dev) [;
exports.Sets = void 0;
class Sets {
/**
* Return the intersection of N sets
*/
static intersection(...xss) {
if (xss.length === 0) {
return new Set();
}
const ret = new Set(xss[0]);
for (const x of xss[0]) {
if (!xss.every((xs) => xs.has(x))) {
ret.delete(x);
}
}
return ret;
}
/**
* Return the union of N sets
*/
static union(...xss) {
return new Set(xss.flatMap((xs) => Array.from(xs)));
}
/**
* Return the diff of 2 sets
*/
static diff(xs, ys) {
return new Set(Array.from(xs).filter((x) => !ys.has(x)));
}
static *intersect(xs, ys) {
for (const x of xs) {
if (ys.has(x)) {
yield x;
}
}
}
}
exports.Sets = Sets;
//# sourceMappingURL=sets.js.map