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 <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
  • 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
Original file line number Diff line number Diff line change
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.