UNPKG

p5-analysis

Version:

API to find, create, and analyze p5.js sketch files.

26 lines (25 loc) 759 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setUnion = exports.setDifference = exports.removeSetElements = void 0; /** Modifies target by removing the items in other. */ function removeSetElements(target, other) { for (const element of other) { target.delete(element); } return target; } exports.removeSetElements = removeSetElements; function setDifference(target, other) { return new Set([...target].filter(x => !other.has(x))); } exports.setDifference = setDifference; function setUnion(...sets) { const union = new Set(); for (const set of sets) { for (const element of set) { union.add(element); } } return union; } exports.setUnion = setUnion;