« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content-function.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content-function.js')
-rw-r--r--src/content-function.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/content-function.js b/src/content-function.js
index 30e0ccc3..53cb13cf 100644
--- a/src/content-function.js
+++ b/src/content-function.js
@@ -339,6 +339,7 @@ export function quickEvaluate({
   name,
   args = [],
   multiple = null,
+  postprocess = null,
 }) {
   if (multiple !== null) {
     return multiple.map(opts =>
@@ -349,6 +350,7 @@ export function quickEvaluate({
         ...opts,
         name: opts.name ?? name,
         args: opts.args ?? args,
+        postprocess: opts.postprocess ?? postprocess,
       }));
   }
 
@@ -436,5 +438,11 @@ export function quickEvaluate({
     slotResults[slot] = runContentFunction(flatRelationSlots[slot]);
   }
 
-  return runContentFunction(root);
+  const topLevelResult = runContentFunction(root);
+
+  if (postprocess !== null) {
+    return postprocess(topLevelResult);
+  } else {
+    return topLevelResult;
+  }
 }