Skip to content

Commit

Permalink
repl: simplify regex expression
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
gengjiawen authored and BridgeAR committed Mar 14, 2019
1 parent 2101371 commit 788c57b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1328,8 +1328,8 @@ function _memory(cmd) {
if (cmd) {
// Going down is { and ( e.g. function() {
// going up is } and )
var dw = cmd.match(/{|\(/g);
var up = cmd.match(/}|\)/g);
let dw = cmd.match(/[{(]/g);
let up = cmd.match(/[})]/g);
up = up ? up.length : 0;
dw = dw ? dw.length : 0;
var depth = dw - up;
Expand Down

0 comments on commit 788c57b

Please sign in to comment.