Meteor Session's support of JS.Set Object

Immediate trials of storing new Set() objects in Session variables; returns empties.

Anyone know when / if Meteor will support them ?

Thank you.

I’m not sure when Set’s will be supported - actually it’s the ESJON package that needs to support them (ESJON stringify in particular), but as a hack you can work around this by converting to an array for storage:

const someSet = new Set();
someSet.add(1);
Session.set('someSetInTheSession', Array.from(someSet));
...
const anotherSet = new Set(Session.get('someSetInTheSession'));
1 Like