Defining a helper for every single Session/Reactive var?

So far I’ve had to do things like this, just to check for boolean states:

Template.myTemplate.helpers({
  conditionOne: function () {
    return Session.get('conditionOne');
  },

  conditionTwo: function () {
    return Session.get('conditionTwo');
  }
});

…which seems kind of redundant and a waste of time. Is there anything wrong with just making a single helper like this?

Template.myTemplate.helpers({
  isTruthy: function (varName) {
    return Session.get(varName);
  }
});

@sashko This is why I think we need to have built in state binding system for Templates.

3 Likes