X-Git-Url: http://git.squeep.com/?p=squeep-html-template-helper;a=blobdiff_plain;f=lib%2Ftemplate-helper.js;fp=lib%2Ftemplate-helper.js;h=2a218f88020c3542a5bc24dffe849293f748c76b;hp=c983e80acd44329fc6c516ee874198fc2d2e6e58;hb=a2c0e2fc57bb8f25f694e16eb4e51d6970b28829;hpb=04484918ab107b834e16ba6918eaa3da80c6b29f diff --git a/lib/template-helper.js b/lib/template-helper.js index c983e80..2a218f8 100644 --- a/lib/template-helper.js +++ b/lib/template-helper.js @@ -6,6 +6,17 @@ const { lazy } = require('@squeep/lazy-property'); + +/** + * Set up expected fields for how we handle error reporting + * and whatnot. + * @param {Object} ctx + */ +const initContext = (ctx) => { + ctx.errors = []; + ctx.notifications = []; +} + /** * Some fields may have values outside normal dates, handle them here. * @param {Date} date @@ -392,6 +403,7 @@ function htmlPage(pagePathLevel, ctx, options, main = []) { module.exports = { + initContext, dateOrNot, dateFormat, timeElement,