Proposal: https://github.com/tc39/proposal-object-equals`
Implement the ability to compare objects based on content as in Java
- add
hashable
option to data descriptor of objects (if the property is to be used in hash calculation. All own properties by default) - add
hashCode
to object instances - add
equals
to object prototype - use fast algorithm to calculate hashCode of objects, arrays etc. (based on hash of own properties and hashes of nested objects)
object1.equals(object2)
or Object.equals(object1, object2)