Skip to content

Commit

Permalink
repl: simplify regex expression
Browse files Browse the repository at this point in the history
PR-URL: nodejs#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 BridgeAR committed Mar 14, 2019
1 parent 36ad91e commit e711cb3
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 e711cb3

Please sign in to comment.