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 BethGriggs committed Apr 16, 2019
1 parent 1080a1a commit 600929d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/repl.js
Expand Up @@ -1315,8 +1315,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 600929d

Please sign in to comment.