Skip to content
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

deepFreeze don't freeze non enumerable props #33

Closed
astur opened this issue Oct 15, 2017 · 7 comments · Fixed by #34
Closed

deepFreeze don't freeze non enumerable props #33

astur opened this issue Oct 15, 2017 · 7 comments · Fixed by #34
Labels

Comments

@astur
Copy link

astur commented Oct 15, 2017

If object contains non enumerable prop with object value, it will not be frozen by deepFreeze.

@snovakovic
Copy link
Owner

snovakovic commented Oct 16, 2017

Freezing of non enumerable properties is available from v3.0.0

Major version has been published because as side effect option to deepFreeze prototype chain has also been removed (braking change). { proto: true } is not longer available because of undesired side effects. For more information on it reference v3.0.0 relese

@astur
Copy link
Author

astur commented Oct 16, 2017

{ proto: true } was dangerous but great feature. I'll miss it :)

@snovakovic
Copy link
Owner

I will review it one more time and and consider bringing it back if I find some nice way of avoiding side effects (freezing built in JavaScript objects and their properties).

@astur
Copy link
Author

astur commented Oct 29, 2017

As I see these side effects can be avoided by stopping prototype chain on one having constructor property. So we can freeze all properties of prototype objects, but not freeze "prototype classes" (including things like global.Object etc.).

This way if you freeze an array length will be frozen but map will not.

look my get-props for example.

@snovakovic
Copy link
Owner

@astur Thanks for information i will investigate it.

I'm also open to contributions if you want to contribute to it?

@snovakovic
Copy link
Owner

@astur new PR is in preparation that should allow freezing of prototype chain #44.

I still need to do some more testing and maybe some small modifications before merging it in.

If you have time feel free to take a look and comment.

Thanks!

@astur
Copy link
Author

astur commented Oct 31, 2017

Looks safe enough. Good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants