Skip to content

Commit 600929d

Browse files
gengjiawenBethGriggs
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 1080a1a commit 600929d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/repl.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1315,8 +1315,8 @@ function _memory(cmd) {
13151315
if (cmd) {
13161316
// Going down is { and ( e.g. function() {
13171317
// going up is } and )
1318-
var dw = cmd.match(/{|\(/g);
1319-
var up = cmd.match(/}|\)/g);
1318+
let dw = cmd.match(/[{(]/g);
1319+
let up = cmd.match(/[})]/g);
13201320
up = up ? up.length : 0;
13211321
dw = dw ? dw.length : 0;
13221322
var depth = dw - up;

0 commit comments

Comments
 (0)