aboutsummaryrefslogtreecommitdiff
path: root/ext/js/templates/sandbox
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-09-26 12:15:00 -0400
committerGitHub <noreply@github.com>2021-09-26 12:15:00 -0400
commit076170cc3880ae673a7a94c64e64ee54afb7cfbc (patch)
treee946fe34421a1ae6927f54e87e1da5b66d7c101d /ext/js/templates/sandbox
parent14b2a9be879710d243bac08c21a9577f17844ae9 (diff)
Fix regexMatch and regexReplace handlebars helper functions (#1958)
Diffstat (limited to 'ext/js/templates/sandbox')
-rw-r--r--ext/js/templates/sandbox/anki-template-renderer.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/js/templates/sandbox/anki-template-renderer.js b/ext/js/templates/sandbox/anki-template-renderer.js
index e15fdba7..b721fadc 100644
--- a/ext/js/templates/sandbox/anki-template-renderer.js
+++ b/ext/js/templates/sandbox/anki-template-renderer.js
@@ -214,7 +214,7 @@ class AnkiTemplateRenderer {
// e.g. "i" for case-insensitive, "g" for replace all
const argCount = args.length - 1;
const options = args[argCount];
- let value = options.fn(context);
+ let value = typeof options.fn === 'function' ? options.fn(context) : '';
if (argCount > 3) {
value = `${args.slice(3).join('')}${value}`;
}
@@ -238,7 +238,7 @@ class AnkiTemplateRenderer {
// e.g. "i" for case-insensitive, "g" for match all
const argCount = args.length - 1;
const options = args[argCount];
- let value = options.fn(context);
+ let value = typeof options.fn === 'function' ? options.fn(context) : '';
if (argCount > 2) {
value = `${args.slice(2).join('')}${value}`;
}