Created
January 16, 2013 18:54
-
-
Save kara-ryli/4549717 to your computer and use it in GitHub Desktop.
A simple handlebars helper that enables testing of value equality. String, number and boolean values are supported.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"tests": [ | |
{ "agree": "yes" }, | |
{ "agree": "no" } | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Handlebars.registerHelper("if_eq", function (test, options) { | |
return (test === options.hash.value) ? options.fn(this) : options.inverse(this); | |
}, true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>I agree.</p> | |
<p>I disagree.</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment