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
The new properties returned by this library are always writable and configurable, even when the original properties were not. While non-writable or non-configurable properties are sometimes problematic, there are sometimes legitimate reasons for it. This seems to be an unintentional side effect.
Additionally, when a property is using get/set, they are currently removed.
constobj=Object.defineProperty({},'prop',{get: ()=>Math.random(),enumerable: true})console.log(obj.prop,obj.prop)// Different random numbersconstobjCopy=includeKeys(obj,['prop'])console.log(objCopy.prop,objCopy.prop)// Same random numbers
Instead of retrieving then copying the property values, the descriptors should be used instead.
The new properties returned by this library are always writable and configurable, even when the original properties were not. While non-writable or non-configurable properties are sometimes problematic, there are sometimes legitimate reasons for it. This seems to be an unintentional side effect.
Additionally, when a property is using
get
/set
, they are currently removed.Instead of retrieving then copying the property values, the descriptors should be used instead.
filter-obj/index.js
Line 8 in 36e5f3a
filter-obj/index.js
Line 20 in 36e5f3a
Note: I can submit a PR.
The text was updated successfully, but these errors were encountered: