How do I use temporary state object as a javascript Set


I want to have a temporary_state that stores all names of products processed so far and then for the next item, need to check if an item with same name has been processed earlier. I wanted to create a temporary_state with initial value as {{ new Set() }} and insert items when it is processed.

But I get errors like "state1.has" is not a function / "state1.add" is not a function

I tried writing the code both ways :
state1.add and state1.value.add but same error in either case. How do I do this?

Check the following: