1
0
Fork 0
mirror of synced 2024-09-30 09:07:25 +13:00

Fixing issue with isValid function found by testcase.

This commit is contained in:
mike12345567 2022-02-08 17:22:44 +00:00
parent 6199f06ea9
commit 07a285843e
2 changed files with 8 additions and 2 deletions

View file

@ -177,7 +177,9 @@ module.exports.isValid = (string, opts) => {
const context = {}
try {
const instance = opts.noHelpers ? hbsInstanceNoHelpers : hbsInstance
instance.compile(processors.preprocess(string, false))(context)
instance.compile(processors.preprocess(string, { noFinalise: true }))(
context
)
return true
} catch (err) {
const msg = err && err.message ? err.message : err

View file

@ -23,9 +23,13 @@ function process(output, processors, opts) {
module.exports.preprocess = (string, opts) => {
let processors = preprocessor.processors
if (opts.noFinalise) {
processors = processors.filter(
processor => processor.name !== preprocessor.PreprocessorNames.FINALISE
)
}
return process(string, processors, opts)
}
module.exports.postprocess = string => {
let processors = postprocessor.processors
return process(string, processors)