emmanueltouzery / prelude-ts

Functional programming, immutable collections and FP constructs for typescript and javascript
ISC License
377 stars 21 forks source link

Support values implementing HasEquals in HashMap.hashCode() #48

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi! After your fix for the HashMap, I was still having some issues when comparing two changed maps when the values were complex classes, even though I did have HasEquals implemented.

After some debugging, I found out that on this line, a hash code would be generated for the string [4,[object Object]] instead of taking into account the value's actual hash code.

I hope this fix for it is ok! Since fieldsHashCode collects all arguments passed to it, this should be fine. Of course, plain objects that don't implement HasEquals will still not generate a sensible hash code.

Thanks again!

emmanueltouzery commented 3 years ago

thank you very much! I'll make a 1.0.2 now with your fix!

emmanueltouzery commented 3 years ago

1.0.2 pushed to npm! Thank you again!