Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCommanderRoot <CommanderRoot@users.noreply.github.com>2022-04-04 21:08:43 +0300
committerGitHub <noreply@github.com>2022-04-04 21:08:43 +0300
commite3da5df4152fbe547f7871547165328e1bf06262 (patch)
tree273fd46ffb39ca4499af4a5b6a8807ba2b32b382 /lib/commands/completion.js
parent44108f7be5e1e928d8aa3eda3c5c177bcd216c99 (diff)
fix: replace deprecated String.prototype.substr() (#4667)
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
Diffstat (limited to 'lib/commands/completion.js')
-rw-r--r--lib/commands/completion.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/commands/completion.js b/lib/commands/completion.js
index d0c68af6c..5b7e0d355 100644
--- a/lib/commands/completion.js
+++ b/lib/commands/completion.js
@@ -97,17 +97,17 @@ class Completion extends BaseCommand {
const word = words[w]
const line = COMP_LINE
const point = +COMP_POINT
- const partialLine = line.substr(0, point)
+ const partialLine = line.slice(0, point)
const partialWords = words.slice(0, w)
// figure out where in that last word the point is.
const partialWordRaw = args[w]
let i = partialWordRaw.length
- while (partialWordRaw.substr(0, i) !== partialLine.substr(-1 * i) && i > 0) {
+ while (partialWordRaw.slice(0, i) !== partialLine.slice(-1 * i) && i > 0) {
i--
}
- const partialWord = unescape(partialWordRaw.substr(0, i))
+ const partialWord = unescape(partialWordRaw.slice(0, i))
partialWords.push(partialWord)
const opts = {