Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow registerPartial to accept an object of templates. Fixes #369

  • Loading branch information...
commit 811885148c5feab9864ceed550af7ec91c1a72d9 1 parent bd04901
@simonsmith simonsmith authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/handlebars/base.js
View
12 lib/handlebars/base.js
@@ -16,7 +16,17 @@ Handlebars.registerHelper = function(name, fn, inverse) {
};
Handlebars.registerPartial = function(name, str) {
- this.partials[name] = str;
+ var type = toString.call(name);
+
+ if(type === '[object Object]') {
+ for(var partial in name) {
+ if(name.hasOwnProperty(partial)) {
+ this.partials[partial] = name[partial];
+ }
+ }
+ } else {
+ this.partials[name] = str;
+ }
};
Handlebars.registerHelper('helperMissing', function(arg) {
Please sign in to comment.
Something went wrong with that request. Please try again.