-
Notifications
You must be signed in to change notification settings - Fork 972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defining built-in properties as non-enumerable. #282
Conversation
Thanks! It looks like this change caused tests to fail if you can take a look, please :) |
In addition for taking a look into the failing tests this change caused, please also add at least one test that verifies the changes you made are working, otherwise your changes are likely to be un-done by another person and no one will noticed it's a problem since nothing will fail. |
Will do, thanks. |
I see now that MemoryStore depends on "cookie" being enumerable (which means other stores probably do as well). I reverted that change; now only methods are non-enumerable. I added a test case for the change. |
Awesome! Can you make those properties configurable, so users can redefine them, if there were doing that for some reason previously? |
I made them configurable. I'm not sure if this was what was desired, but I also made them writable, since they were writable previously. Thus, the only change introduced by this patch is making them non-enumerable. |
Thank you so much! Yea, I'm not sure that they need to be configurable, but I just don't quite know what people are doing out there, and figured that getting this in a minor version that would at least be one less possible break :) |
I would like to be able to iterate over all data in a session, like so:
for (var key in req.session) { console.log(key + '=' + req.session[key]); }
Currently this is complicated by the fact that the session object contains non-data properties such as
save
,touch
, andcookie
. This patch simply defines those properties as non-enumerable usingObject.defineProperty
so that the above iteration technique works correctly.