Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 0819657

Browse files
committed
fix(bin/repl.js): improve keyword detection
1 parent 4ee3fb3 commit 0819657

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bin/repl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ async function evaluate (cmd, ctx, file, callback) {
244244
cmd = `void (${cmd}).then((result) => console.log(io.util.format(result)))`
245245
} else if (lastName) {
246246
cmd = `${cmd}; io.util.format(${lastName});`
247-
} else if (!/^\s*(throw|with|try|const|let|var|if|for|while|do|return|import)/.test(cmd)) {
247+
} else if (!/^\s*((throw\s)|(with\s*\()|(try\s*{)|(const\s)|(let\s)|(var\s)|(if\s*\()|(for\s*\()|(while\s*\()|(do\s*{)|(return\s)|(import\s*\())/.test(cmd)) {
248248
cmd = `io.util.format(${cmd});`
249249
}
250250
}

0 commit comments

Comments
 (0)