wycats/handlebars.js — pull request #566 by tniswong (2013-06-28 20:19:00+00:00)
Title: New Helper: ifTest. Allow's for javascript expression evaluation.

http://jsfiddle.net/YsteK/

Consider the following context:
var context = { foo: "bar", baz: [ "qux", "quux" ] };

{{#ifTest 'foo == "bar"'}}
Foobar!
{{/ifTest}}

Result: Foobar!

--

{{#ifTest 'foo != "bar"'}}
Not Foobar!
{{else}}
Foobar!
{{/ifTest}}

Result: Foobar!

--

{{#each baz}}
{{#ifTest 'this == "qux"'}} baz contains a qux! {{/ifTest}}
{{/each}}

Result: baz contains a qux!

--

{{#with baz}}
{{#ifTest 'this.length > 0'}}
The length is greater than 0!
{{/ifTest}}
{{/with}}

Result: The length is greater than 0!

--

{{#each baz}}
{{#ifTest '@index < baz.length - 1' baz=../baz}}
{{this}},
{{else}}
{{this}}.
{{/ifTest}}
{{/each}} Yay comma's!

Result: qux, quux. Yay comma's!