Skip to content

Instantly share code, notes, and snippets.

@KATT
Created June 26, 2013 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save KATT/5866761 to your computer and use it in GitHub Desktop.
Save KATT/5866761 to your computer and use it in GitHub Desktop.
Handlebar helper `or` - grabs the first *truthy* argument that you send in and outputs it. See running example at http://cdpn.io/mxBjE
// Handlebar helper
Handlebars.registerHelper('or', function () {
var args = arguments;
for (var i in args) {
if (args[i]) {
return args[i];
}
}
return null;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment