Skip to content

Commit 788c57b

Browse files
gengjiawenBridgeAR
authored andcommitted
repl: simplify regex expression
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]>
1 parent 2101371 commit 788c57b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: lib/repl.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1328,8 +1328,8 @@ function _memory(cmd) {
13281328
if (cmd) {
13291329
// Going down is { and ( e.g. function() {
13301330
// going up is } and )
1331-
var dw = cmd.match(/{|\(/g);
1332-
var up = cmd.match(/}|\)/g);
1331+
let dw = cmd.match(/[{(]/g);
1332+
let up = cmd.match(/[})]/g);
13331333
up = up ? up.length : 0;
13341334
dw = dw ? dw.length : 0;
13351335
var depth = dw - up;

0 commit comments

Comments
 (0)