Skip to content

Instantly share code, notes, and snippets.

@adamblank
Last active December 30, 2015 19:39
Show Gist options
  • Save adamblank/7875176 to your computer and use it in GitHub Desktop.
Save adamblank/7875176 to your computer and use it in GitHub Desktop.
Add a compile method to underscore, to accommodate for typeahead's expected API
_.compile = function(templ) {
var compiled = this.template(templ);
compiled.render = function(ctx) {
return this(ctx);
};
return compiled;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment