areEqual doesn't support objects with null prototypes
p7g opened this issue · 0 comments
p7g commented
In areEqual
, there is a branch where the valueOf
both objects is compared if supported, but the check for if it's supported raises an exception if the objects don't have the Object
prototype.
Specifically, since it does a.hasOwnProperty("valueOf")
, if a
doesn't have a hasOwnProperty
method it will fail.
It's possible the solution would be to use Object.hasOwnProperty.call(a, "valueOf")
instead, but I'm not clear on any semantic differences there might be. If that's acceptable, I can open a pull request.
For some context, I ran into this issue when passing a value from another library to Relay's RecordProxy.setValue
. That other library happens to create some objects like Object.create(null)
.