helpers.js
433 Bytes
'use strict';
const _ = require('lodash');
const helpers = {
equals: (a, b, opts) => {
if (a === b) {
return opts.fn(this);
} else {
return opts.inverse(this);
}
},
replace: (str, pattern, replacement) => {
return _.replace(str, new RegExp(pattern), replacement);
},
json: (obj) => {
return JSON.stringify(obj);
}
};
module.exports = helpers;