From f10239fde781b6fdd7c13c8e2cec16d4e3071280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrg=C3=BCn=20Day=C4=B1o=C4=9Flu?= Date: Tue, 10 Dec 2024 13:18:18 +0100 Subject: [PATCH] lib: remove redundant global regexps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/56182 Reviewed-By: Michaël Zasso Reviewed-By: Juan José Arboleda Reviewed-By: Yagiz Nizipli Reviewed-By: LiviaMedeiros Reviewed-By: Luigi Pinca --- lib/internal/util/debuglog.js | 2 +- lib/url.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/util/debuglog.js b/lib/internal/util/debuglog.js index 271c9d1497d88f..96b10c4bbac767 100644 --- a/lib/internal/util/debuglog.js +++ b/lib/internal/util/debuglog.js @@ -173,7 +173,7 @@ function formatTime(ms) { } function safeTraceLabel(label) { - return label.replace(/\\/g, '\\\\').replaceAll('"', '\\"'); + return label.replaceAll('\\', '\\\\').replaceAll('"', '\\"'); } /** diff --git a/lib/url.js b/lib/url.js index ef1b1a23d9a5c8..8acec11816f88e 100644 --- a/lib/url.js +++ b/lib/url.js @@ -705,7 +705,7 @@ Url.prototype.format = function format() { } } - search = search.replace(/#/g, '%23'); + search = search.replaceAll('#', '%23'); if (hash && hash.charCodeAt(0) !== CHAR_HASH) hash = '#' + hash;