const Handlebars = require('handlebars'); const config = require('../config/speechConfig.js'); module.exports = { // define any extra helpers you may need googleAnalytics () { const googleApiKey = config.analytics.googleId; return new Handlebars.SafeString( `` ); }, addOpenGraph (title, mimeType, showUrl, source, description, thumbnail) { let basicTags = ` `; if (mimeType === 'video/mp4') { return new Handlebars.SafeString( `${basicTags} ` ); } else if (mimeType === 'image/gif') { return new Handlebars.SafeString( `${basicTags} ` ); } else { return new Handlebars.SafeString( `${basicTags} ` ); } }, addTwitterCard (mimeType, source, embedUrl, directFileUrl) { let basicTwitterTags = ``; if (mimeType === 'video/mp4') { return new Handlebars.SafeString( `${basicTwitterTags} ` ); } else { return new Handlebars.SafeString( `${basicTwitterTags} ` ); } }, ifConditional (varOne, operator, varTwo, options) { switch (operator) { case '===': return (varOne === varTwo) ? options.fn(this) : options.inverse(this); case '!==': return (varOne !== varTwo) ? options.fn(this) : options.inverse(this); case '<': return (varOne < varTwo) ? options.fn(this) : options.inverse(this); case '<=': return (varOne <= varTwo) ? options.fn(this) : options.inverse(this); case '>': return (varOne > varTwo) ? options.fn(this) : options.inverse(this); case '>=': return (varOne >= varTwo) ? options.fn(this) : options.inverse(this); case '&&': return (varOne && varTwo) ? options.fn(this) : options.inverse(this); case '||': return (varOne || varTwo) ? options.fn(this) : options.inverse(this); case 'mod3': return ((parseInt(varOne) % 3) === 0) ? options.fn(this) : options.inverse(this); default: return options.inverse(this); } }, };