Skip to content

Instantly share code, notes, and snippets.

@bfsong
Last active March 12, 2017 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bfsong/71a2d3b5be957d6f0a867d3b203a28a5 to your computer and use it in GitHub Desktop.
Save bfsong/71a2d3b5be957d6f0a867d3b203a28a5 to your computer and use it in GitHub Desktop.
Handlebars Helpers
Handlebars.registerHelper('ifgt', function (val1, val2, options) {
if (val1 > val2) {
return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper('iflt', function (val1, val2, options) {
if (val1 < val2) {
return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper('ifeq', function (val1, val2, options) {
if (val1 == val2) {
return options.fn(this);
}
return options.inverse(this);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment