You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var o = {};
Object.defineProperty(o, 'foo', {enumerable:true, writable:false, value:'f'});
var o2 = _.clone(o);
console.log(Object.getOwnPropertyDescriptor(o2, 'foo'));
The property descriptor on the copied object specifies the property as writable even though the original property wasn't writable.
I also noticed that clone() and cloneDeep() only copy enumerable properties, but that's mentioned in the documentation so I assume it's deliberate (might be nice to add an option to copy them if desired).
The text was updated successfully, but these errors were encountered:
Thanks for the quick clarification! The docs could be clearer on this, but I just looked again and it does say that properties "are cloned as plain objects", which I'm guessing might have been meant to indicate that.
Consider the following example:
The property descriptor on the copied object specifies the property as
writable
even though the original property wasn't writable.I also noticed that
clone()
andcloneDeep()
only copy enumerable properties, but that's mentioned in the documentation so I assume it's deliberate (might be nice to add an option to copy them if desired).The text was updated successfully, but these errors were encountered: