export function setToArray(set: Set): T[] { if (Array.from) return Array.from(set); const array: T[] = []; set.forEach((value: T) => { array.push(value); }); return array; } export function returnSetsUnion(set: Set, set2: Set): Set { return new Set(setToArray(set).concat(setToArray(set2))); } export function returnDifference(list: T[] = [], list2: T[] = []): T[] { return list.filter(item => list2.indexOf(item) === -1); }