We have WeakSet in JS now, but sometimes i've run into situations where I want to be able to iterate over a WeakSet's contents.
We can accomplish this using a regular Set holding WeakRefs, and a WeakMap to tie items themselves to their WeakRefs.
This only cleans up empty WeakRefs when it is iterated, so will retain empty WeakRef items unless you iterate it sometimes.
The following Set methods & properties are not implemented:
size
clear()
difference()
entries()
forEach()
intersection()
isDisjointFrom()
isSubsetOf()
isSupersetOf()
keys()
symmetricDifference()
union()
values()