mirror of
https://github.com/jsbin/jsbin.git
synced 2026-01-25 15:38:56 +00:00
20 lines
488 B
JavaScript
20 lines
488 B
JavaScript
'use strict';
|
|
var hbs = require('hbs'),
|
|
features = require('./features'),
|
|
path = require('path');
|
|
|
|
hbs.registerPartials(path.resolve(__dirname + '/../views/partials'));
|
|
|
|
hbs.registerHelper('feature', function(request, flag, options) {
|
|
if (features(flag, request)) {
|
|
return options.fn(this);
|
|
} else if (options.inverse) {
|
|
return options.inverse(this);
|
|
}
|
|
});
|
|
|
|
hbs.registerHelper('dump', function(obj) {
|
|
return JSON.stringify(obj, null, 2);
|
|
});
|
|
|
|
module.exports = hbs; |