const session = new Proxy(req.session, {
set(obj, attribute, value) {
const property = someMagicOnAttribute(attribute);
console.log(property, obj)
obj[property] = value;
return true; // probably bad but hey
}
});
session.authed = true; // modAuthed, {...}
session.xyz = 123; // modXyz, {..., modAuthed: true }
session.id = 123; // modId, {..., modAuthed, xyz } TypeError