UNPKG

jsii

Version:

[![Join the chat at https://cdk.Dev](https://img.shields.io/static/v1?label=Slack&message=cdk.dev&color=brightgreen&logo=slack)](https://cdk.dev) [![All Contributors](https://img.shields.io/github/all-contributors/aws/jsii/main?label=%E2%9C%A8%20All%20Con

41 lines 969 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); 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