What's an effective way to eliminate null checking boilerplate in computed properties?


#1

In nearly all cases when writing a computed property, I have to perform a check against the dependent properties to make sure I have a good reference. This leads to a lot of my computed property methods looking something like:

var dependentProperty1 = this.get('dependentProperty1');
var dependentProperty2 = this.get('dependentProperty2'); 

if(!Ember.isNone(dependentProperty) && !Ember.isNone(dependentProperty2)) { 
   //return something with dependentProperty1 and dependentProperty2
} else { 
   return null; 
}

Is there an generally accepted way to eliminate having to perform null reference checks in every computed property? I realize that I could write my own computed property that wraps another closure, but this feels like it’d be a useful framework-level feature.