projects
/
squeep-html-template-helper
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add initContext helper to set fields we expect to be present
[squeep-html-template-helper]
/
lib
/
template-helper.js
diff --git
a/lib/template-helper.js
b/lib/template-helper.js
index c983e80acd44329fc6c516ee874198fc2d2e6e58..2a218f88020c3542a5bc24dffe849293f748c76b 100644
(file)
--- a/
lib/template-helper.js
+++ b/
lib/template-helper.js
@@
-6,6
+6,17
@@
const { lazy } = require('@squeep/lazy-property');
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
/**
* 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 = {
module.exports = {
+ initContext,
dateOrNot,
dateFormat,
timeElement,
dateOrNot,
dateFormat,
timeElement,