From ed293fc520d75375c53fe1ff157dd33e87bec35c Mon Sep 17 00:00:00 2001 From: Jithil P Ponnan Date: Sun, 12 Nov 2023 02:44:16 +1100 Subject: [PATCH] lib: remove deprecated string methods PR-URL: https://github.com/nodejs/node/pull/50592 Reviewed-By: Marco Ippolito Reviewed-By: Paolo Insogna Reviewed-By: James M Snell --- lib/_http_agent.js | 4 ++-- lib/internal/main/print_help.js | 4 ++-- lib/repl.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/_http_agent.js b/lib/_http_agent.js index e23409f2ee797f..a4829526f6e138 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -38,7 +38,7 @@ const { StringPrototypeIndexOf, StringPrototypeSplit, StringPrototypeStartsWith, - StringPrototypeSubstr, + StringPrototypeSubstring, Symbol, } = primordials; @@ -363,7 +363,7 @@ function calculateServerName(options, req) { // Leading '[', but no ']'. Need to do something... servername = hostHeader; } else { - servername = StringPrototypeSubstr(hostHeader, 1, index - 1); + servername = StringPrototypeSubstring(hostHeader, 1, index); } } else { servername = StringPrototypeSplit(hostHeader, ':', 1)[0]; diff --git a/lib/internal/main/print_help.js b/lib/internal/main/print_help.js index edb861668cac3d..73227fbd9cb456 100644 --- a/lib/internal/main/print_help.js +++ b/lib/internal/main/print_help.js @@ -11,7 +11,7 @@ const { RegExpPrototypeSymbolReplace, StringPrototypeLocaleCompare, StringPrototypeSlice, - StringPrototypeTrimLeft, + StringPrototypeTrimStart, StringPrototypeRepeat, SafeMap, } = primordials; @@ -180,7 +180,7 @@ function format( else text += StringPrototypeRepeat(' ', firstColumn - displayName.length); - text += StringPrototypeTrimLeft( + text += StringPrototypeTrimStart( indent(fold(displayHelpText, secondColumn), firstColumn)) + '\n'; } diff --git a/lib/repl.js b/lib/repl.js index d8021215b3f425..3029c94b1e1ac0 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -90,7 +90,7 @@ const { StringPrototypeSplit, StringPrototypeStartsWith, StringPrototypeTrim, - StringPrototypeTrimLeft, + StringPrototypeTrimStart, StringPrototypeToLocaleLowerCase, Symbol, SyntaxError, @@ -1326,7 +1326,7 @@ function complete(line, callback) { let completeOn, group; // Ignore right whitespace. It could change the outcome. - line = StringPrototypeTrimLeft(line); + line = StringPrototypeTrimStart(line); let filter = '';