emmanueltouzery / prelude-ts

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

Option equality broken #74

Closed jorge-fernandes closed 1 year ago

jorge-fernandes commented 1 year ago

Hi,

stumbled upon a new equality issue

Option.of(Vector.of(12, 2674)).equals(Option.of(null))

yields true

i'm on "prelude-ts": "1.0.5"

emmanueltouzery commented 1 year ago

well, that's very crappy. I'll fix it tonight my time. I see the problem...

    if (obj === null != obj2 === null) {
        return false;
    }

due to operator priority the bracketing was wrong...

  if ((obj === null) != (obj2 === null)) {
    return false;
  }

this fixes it. I'll push and release tonight.

emmanueltouzery commented 1 year ago

I have now released 1.0.6 on npm. Sorry for the bad bug :grimacing: