title: Handlerbars.js using an helper function in a #if statement
body: <p>With <a href="http://www.handlebarsjs.com/" rel="nofollow">handlebars.js</a> I want to display two blocks of html depending of a resulting json.</p>
  
  <p>Let's say I want to thanks my user for ordering items at my shop.
  I write my handlerbars.js template like this :</p>
  
  <pre><code>&lt;p&gt;{{name}}&lt;/p&gt;
  {{#if costIsZero}}
    Can't find any order
  {{else}}
      You bought {{cost}} items in our shop, thanks.
  {{/if}}
  </code></pre>
  
  <p>I'm coding a simple helper for costIsZero like this :</p>
  
  <pre><code>Handlebars.registerHelper('costIsZero', function(){
      return this.cost == 0
  });
  </code></pre>
  
  <p>When I mix it with the following json data :</p>
  
  <pre><code>var data = {
    "name":"foo",
    "cost": 9
  };
  </code></pre>
  
  <p>Whatever the value of "cost" is the {{#if costIsZero}} seems always to be true.
  If I comment out the helper itself, thus having nothing for costIsZero it returns always false.</p>
  
  <p>All the code above is available as a JSFiddle there <a href="http://jsfiddle.net/gsSyt/" rel="nofollow">http://jsfiddle.net/gsSyt/</a></p>
  
  <p>What I'm doing wrong ?</p>
  
  <p>Maybe I'm hijacking the way handlebars.js work, but in that case, How should I implement my feature with handlebars.js ?</p>