Doesn't compare object with prototype
See original GitHub issuedequal(Object.create({x:1}), {x:1}) //false
Other deep equal libs do that fine.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
JavaScript compare object prototype and sum them
JavaScript compare object prototype and sum them ... This line new Mes(mes, lluvia); is unnecessary. It creates an object but doesn't save it ......
Read more >Comparing object with null prototype and objects derived from ...
How about two objects with null prototypes? The second test should pass right? It's complaining that the object doesn't have hasOwnProperty ...
Read more >Object.prototype.isPrototypeOf() - JavaScript - MDN Web Docs
The isPrototypeOf() method checks if an object exists in another object's prototype chain. Note: isPrototypeOf() differs from the instanceof ...
Read more >Getting the differences between two objects with vanilla JS
First, we'll setup our function, passing in our original object and the object to compare it to as arguments. If the second object...
Read more >Understanding Prototypes and Inheritance in JavaScript
At the end of the prototype chain is Object.prototype . All objects inherit the properties and methods of Object . Any attempt to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dy that is not what you opened an issue about.
Also, Arrays can be strictly deep-equal with that syntax, but not
NodeList
s because that’s of different type (iterator). Iterators are not currently supported but will be in the new mode I’ll ship soon, which already includes Map and Set support. I may generalize that to any Iterator type.What you can do in the meantime, since it sounds like you’re explicitly checking for
childNodes
, is cast the NodeList to an Array vialist = Array.from(el.childNodes);
– that will then work out of the box.Proof:
Hey,
I was on the move when I first looked at this issue. This should be false.
An object with
x
on the prototype is strictly not the same thing as an object with anx
(writable, enumerable) property.Not sure what other libraries you were looking at/comparing with, but if they’re meant to be a “deep equality” check, then they have a bug.
Confirmed with two others below:
Hope that helps!