Skip to content

Commit d14fbbb

Browse files
committed
fix: items is not defined in each, close #107
1 parent 504c722 commit d14fbbb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,14 @@ function walk (opts, nodes) {
341341

342342
// parse the "loop" param
343343
const loopParams = parseLoopStatement(node.attrs.loop)
344-
const target = vm.runInContext(loopParams.expression, ctx)
344+
let target = {}
345+
try {
346+
target = vm.runInContext(loopParams.expression, ctx)
347+
} catch (error) {
348+
if (opts.strictMode) {
349+
throw new SyntaxError(error)
350+
}
351+
}
345352

346353
// handle additional syntax errors
347354
if (typeof target !== 'object') {

0 commit comments

Comments
 (0)