Ensure null or empty values don't cause raw JS to appear when executing JS HBS helper
This commit is contained in:
parent
7f3c589ae8
commit
5691be6fc0
|
@ -36,7 +36,11 @@ module.exports.processJS = (handlebars, context) => {
|
||||||
|
|
||||||
// Create a sandbox with out context and run the JS
|
// Create a sandbox with out context and run the JS
|
||||||
vm.createContext(sandboxContext)
|
vm.createContext(sandboxContext)
|
||||||
return vm.runInNewContext(js, sandboxContext)
|
const result = vm.runInNewContext(js, sandboxContext)
|
||||||
|
if (result == null || result === "") {
|
||||||
|
return " "
|
||||||
|
}
|
||||||
|
return result
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return "Error while executing JS"
|
return "Error while executing JS"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue