Skip to content

Instantly share code, notes, and snippets.

@msenkpiel
Created March 5, 2015 12:45
Show Gist options
  • Save msenkpiel/f471bad9ecd85ab5e207 to your computer and use it in GitHub Desktop.
Save msenkpiel/f471bad9ecd85ab5e207 to your computer and use it in GitHub Desktop.
Handlebars Helper
/**
* 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