repl: remove redundant escape

PR-URL: https://github.com/nodejs/node/pull/26496
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
gengjiawen 2019-03-07 22:31:13 +08:00 committed by Ruben Bridgewater
parent b7568e1b27
commit a26e9a8a57
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -232,7 +232,7 @@ function REPLServer(prompt,
let awaitPromise = false;
const input = code;
if (/^\s*\{/.test(code) && /\}\s*$/.test(code)) {
if (/^\s*{/.test(code) && /}\s*$/.test(code)) {
// It's confusing for `{ a : 1 }` to be interpreted as a block
// statement rather than an object literal. So, we first try
// to wrap it in parentheses, so that it will be interpreted as