Another option is you could use JSON.stringify() to keep your object unique, that way it is comparing against a string instead of an object reference.
set.add(JSON.stringify({name:'a', value: 'b'}))
and then after everything is formatted you can just parse those lines back to an array like this:
const formattedSet = [...set].map(item) => {
if (typeof item === 'string') return JSON.parse(item);
else if (typeof item === 'object') return item;
});