snovakovic/js-flock

deepFreeze don't freeze non enumerable props

Closed this issue · 7 comments

astur commented

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

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 commented

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

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 commented

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.

@astur Thanks for information i will investigate it.

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

@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 commented

Looks safe enough. Good.