-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
38 lines (32 loc) · 1.02 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
if ( typeof module === "object" && module && typeof module.exports === "object" ){
var isNode = true, define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
var helpers = require('./lib/helpers');
module.exports = {
register: function(Hbs) {
if (!Hbs) throw Error('Handlebars is required!');
var args = Array.prototype.slice.call(arguments);
var toRegister = [];
if (!args[1]) {
toRegister = Object.keys(helpers);
} else if (Array.isArray(args[1])) {
toRegister = args[1];
} else {
toRegister = args.slice(1);
}
toRegister.forEach(function(helper) {
Hbs.registerHelper(helper, helpers[helper]);
});
},
unregister: function(Hbs) {
if (!Hbs) throw new Error('Handlebars is required!');
var args = Array.prototype.slice.call(arguments);
Hbs.unregisterHelper(args.slice(1));
},
_helpers: helpers
}
return module.exports;
});