Last active
March 12, 2017 14:48
-
-
Save bfsong/71a2d3b5be957d6f0a867d3b203a28a5 to your computer and use it in GitHub Desktop.
Handlebars Helpers
This file contains 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('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