1
0
Fork 0
mirror of synced 2024-09-29 08:41:16 +13:00

Ensure null or empty values don't cause raw JS to appear when executing JS HBS helper

This commit is contained in:
Andrew Kingston 2021-10-12 15:32:43 +01:00
parent f0d79a34ed
commit 4174b88057

View file

@ -36,7 +36,11 @@ module.exports.processJS = (handlebars, context) => {
// Create a sandbox with out context and run the JS
vm.createContext(sandboxContext)
return vm.runInNewContext(js, sandboxContext)
const result = vm.runInNewContext(js, sandboxContext)
if (result == null || result === "") {
return " "
}
return result
} catch (error) {
return "Error while executing JS"
}