Created
March 5, 2015 12:45
-
-
Save msenkpiel/f471bad9ecd85ab5e207 to your computer and use it in GitHub Desktop.
Handlebars Helper
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
/** | |
* when helper | |
* | |
* {{#when foo bar}} | |
* eat this | |
* {{/when}} | |
*/ | |
Handlebars.registerHelper('when', function (a, b, options) { | |
if(String(a).toLowerCase() == String(b).toLowerCase()){ | |
return options.fn(this); | |
} | |
}); | |
/** | |
* uglycard helper | |
*/ | |
Handlebars.registerHelper('uglycard', function (str, options) { | |
return String(str).substr(0, 11) + 'XXXX'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment