Skip to content

Commit

Permalink
fix(loading): use the register function
Browse files Browse the repository at this point in the history
should fix #4
  • Loading branch information
zeropaper committed Nov 16, 2014
1 parent 0494e40 commit b434036
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions moment.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
*/

/*jshint node:true */
module.exports = function (config) {
var helpers = {};
'use strict';
module.exports.register = function (Handlebars, options, params) {
var moment = require('moment');
var _ = require('lodash');

helpers.moment = function(context, block) {
Handlebars.registerHelper('moment', function (context, block) {
if (context && context.hash) {
block = _.cloneDeep(context);
context = undefined;
Expand All @@ -33,9 +33,9 @@ module.exports = function (config) {
}
}
return date;
};
});

helpers.duration = function(context, block) {
Handlebars.registerHelper('duration', function (context, block) {
if (context && context.hash) {
block = _.cloneDeep(context);
context = 0;
Expand All @@ -53,7 +53,5 @@ module.exports = function (config) {
}
}
return duration;
};

return helpers;
});
};

0 comments on commit b434036

Please sign in to comment.