Multi argument 'if' & 'unless' conditionals in Spacebars for Meteor.js
Gist: https://gist.github.com/victorbstan/3462664de456146e87db
// dependency: https://lodash.com 
Template.registerHelper('any', function () {
  var any = false;
  var cleanArgs = lodash.filter(arguments, function ( arg ) {
    if ( lodash.isArray( arg ) )
      return true;
  });
  for ( var i = 0; i < cleanArgs.length; i++ ) {
    if ( ! lodash.isEmpty( cleanArgs[i] ) )
      any = true;
  };
  return any;
});
<!--
Usage examples
-->
<!-- IF ANY -->
{{#if any truthyOne truthyTwo falsyThree}}
  You will see this.
{{/if}}
{{#if any falsyOne falsyTwo falsyThree}}
  You won't see this.
{{/if}}
<!-- UNLESS ANY -->
{{#unless any falsyOne falsyTwo falsyThree}}
  You will see this.
{{/unless}}
{{#unless any falsyOne falsyTwo truthyThree}}
  You won't see this.
{{/unless}}Written by Victor Stan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#