Fixing issue with isValid function found by testcase.
This commit is contained in:
parent
6199f06ea9
commit
07a285843e
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue