/// export function difference(source: Set, target: Set): Set { if ('difference' in Set.prototype) { return source.difference(target) } const result = new Set() for (const item of source) { if (!target.has(item)) { result.add(item) } } return result } export function intersection(source: Set, target: Set): Set { if ('intersection' in Set.prototype) { return source.intersection(target) } const result = new Set() for (const item of source) { if (target.has(item)) { result.add(item) } } return result }