jmurphyau/ember-truth-helpers

All equality operators should use Ember.isEqual

devinus opened this issue · 5 comments

=== doesn't check for Ember's built-in equality checking for objects, dates, etc.

True, but === is much faster than isEqual.

I do agree that we should try to use isEqual though. I'm happy to review a PR for this, but I don't think I'll have much time to work on it for a while...

Yeah I've always had a thought of using isEqual - never as the main method though.. like maybe an option people can provide.

Thinking more a global option - you can have it on or off.. I would discourage an option being passed into the helper directly.. .. {{if (eq a b useIsEqual=true)}} or something would be painful to see in templates

I usually try to go with the most newb-friendly option by default, so using isEqual I think should be default. Using === for micro-optimization should be opt-in, e.g. (eq a b native=true)

I also think this change would require a semver major bump as well.

taras commented

I came here to create an issue for Ember.isEqual support, but found this one instead. isEqual has been part of Ember APIs since 2.1.0. At this point, lack of support might be a bug rather than a breaking change.

I just added an issue to ember-composable-helpers that proposes support for Ember.isEqual. I would argue that isEqual should be default behaviour without a flag.

I'll submit a PR if you'll accept it.