Created
June 26, 2013 11:37
-
-
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
This file contains hidden or 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
// 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