title: Handlebars If-Else If-Else With String Equality Function
body: <p>HandlebarsJS doesn't support string equality ('==') so I have to write my own helper, but this answer isn't clear:</p>
  
  <p><a href="https://stackoverflow.com/a/15095019/1005607">https://stackoverflow.com/a/15095019/1005607</a></p>
  
  <pre><code>Handlebars.registerHelper('if_eq', function(a, b, opts) {
      if(a == b) // Or === depending on your needs
          return opts.fn(this);
      else
          return opts.inverse(this);
  });
  </code></pre>
  
  <p>and then adjust your template:</p>
  
  <pre><code>{{#if_eq this "some message"}}
      ...
  {{else}}
      ...
  {{/if_eq}}
  </code></pre>
  
  <p>1) Why is he doing <code>{{#if_eq ..}}</code> rather than <code>{{#if if_eq .. }}</code> ?</p>
  
  <p>2) I also need to do <strong>ELSE-IF</strong>, which is supported since Handlebars 3.0.0 (I have 4.0). But using his notation, I wouldn't be able to do <code>{{#elseif_eq}}</code> there is no such expression. How would I implement an ELSE-IF with this custom helper?</p>