Skip to content

Commit e307e17

Browse files
CommanderRootwraithgar
authored andcommittedApr 5, 2022
fix: replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
1 parent 9a0ec63 commit e307e17

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
 

‎lib/bin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const parseArg = arg => {
110110
const k = split.shift()
111111
const v = split.join('=')
112112
const no = /^no-/.test(k) && !v
113-
const key = (no ? k.substr(3) : k)
113+
const key = (no ? k.slice(3) : k)
114114
.replace(/^tag$/, 'defaultTag')
115115
.replace(/-([a-z])/g, (_, c) => c.toUpperCase())
116116
const value = v ? v.replace(/^~/, process.env.HOME) : !no

‎lib/util/trailing-slashes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const removeTrailingSlashes = (input) => {
22
// in order to avoid regexp redos detection
33
let output = input
44
while (output.endsWith('/')) {
5-
output = output.substr(0, output.length - 1)
5+
output = output.slice(0, -1)
66
}
77
return output
88
}

‎test/fixtures/abbrev/abbrev.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function abbrev (list) {
6060
abbrevs[current] = current
6161
continue
6262
}
63-
for (var a = current.substr(0, j); j <= cl; j++) {
63+
for (var a = current.slice(0, j); j <= cl; j++) {
6464
abbrevs[a] = current
6565
a += current.charAt(j)
6666
}

0 commit comments

Comments
 (0)
Please sign in to comment.