Skip to content

Instantly share code, notes, and snippets.

@jimbog
Forked from gwendall/helper.js
Last active August 29, 2015 14:11
Show Gist options
  • Save jimbog/e4452a9d125f9e6e958d to your computer and use it in GitHub Desktop.
Save jimbog/e4452a9d125f9e6e958d to your computer and use it in GitHub Desktop.
UI.registerHelper('_', function() {
arguments = _.toArray(arguments);
var self = this,
fn = arguments[0];
arguments.shift(); // Removes the Underscore function
arguments.pop(); // Remove the Spacebars appended argument
return _[fn].apply(self, arguments);
});
/*
Example:
{{#if _ "isString" "bonjour"}}
It is!
{{else}}
It is not :(
{{/if}}
Would return "It is!"
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment