diff --git a/lib/repl.js b/lib/repl.js index db5754ec041196..4e9a79548b04cc 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -478,6 +478,19 @@ function REPLServer(prompt, evalCmd = evalCmd + '\n'; } + // Exponentiation operator + if (cmd && cmd.split('').indexOf('*') !== -1) { + + const cmdArray = cmd.split(''); + const index = cmdArray.indexOf('*'); + + if (cmdArray[index + 1]) { + self.outputStream.write('SyntaxError: Unexpected token *\n'); + finish(null); + return; + } + } + debug('eval %j', evalCmd); self.eval(evalCmd, self.context, 'repl', finish);