jkroso / equals

Check if two values are deeply equivalent
MIT License
11 stars 11 forks source link

Support for enumerable properties #13

Open codeandcats opened 5 years ago

codeandcats commented 5 years ago

In the README you mention that:

Non enumerable properties will not be checked. They can't be.

I notice you are using a for ... in loop to iterate over the properties of an object.

From my understanding, for ... in loops will not include enumerable properties, however Object.getOwnPropertyNames does.

I'm curious if there's a specific reason you didn't / can't use it instead? Is it because for ... in includes inherited properties from up the prototype chain?

jkroso commented 5 years ago

Yeah if you were to use getOwnPropertyNames you would have to recur on the prototype