export function sliceSet < T > ( set ) { const items = [ ] ; set . forEach ( ( value ) => items . push ( value ) ) ; return items ; } export function setIntersection < T > ( set1 , set2 ) { return new Set ( sliceSet ( set1 ) . filter ( ( x ) => set2 . has ( x ) ) ) ; } export function setUnion < T > ( set1 , set2 ) { return new Set ( [ ... sliceSet ( set1 ) , ... sliceSet ( set2 ) ] ) ; } export function sliceMapValues < T , U > ( map ) { const items = [ ] ; map . forEach ( ( value ) => items . push ( value ) ) ; return items ; }