1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-22 16:30:11 +00:00
HackMyResume/dist/helpers/handlebars-helpers.js
hacksalot 917fd8e3f3 Refactor helpers.
Rebind Handlebars helpers to drop the pesky options hash for standalone
helpers that don't need it. Move block helpers (which do need the
Handlebars options/context) to a separate file for special handling.
2016-02-14 04:10:23 -05:00

49 lines
1.1 KiB
JavaScript

/**
Template helper definitions for Handlebars.
@license MIT. See LICENSE.md for details.
@module handlebars-helpers.js
*/
(function() {
var HANDLEBARS, _, blockHelpers, helpers;
HANDLEBARS = require('handlebars');
_ = require('underscore');
helpers = require('./generic-helpers');
blockHelpers = require('./block-helpers');
/**
Register useful Handlebars helpers.
@method registerHelpers
*/
module.exports = function(theme, opts) {
var wrappedHelpers;
helpers.theme = theme;
helpers.opts = opts;
helpers.type = 'handlebars';
wrappedHelpers = _.mapObject(helpers, function(hVal, hKey) {
if (_.isFunction(hVal)) {
_.wrap(hVal, function(func) {
var args;
args = Array.prototype.slice.call(arguments);
args.shift();
args.pop();
return func.apply(this, args);
});
}
return hVal;
}, this);
HANDLEBARS.registerHelper(wrappedHelpers);
HANDLEBARS.registerHelper(blockHelpers);
};
}).call(this);
//# sourceMappingURL=handlebars-helpers.js.map