Skip to content

Commit

Permalink
fix: replace deprecated String.prototype.substr()
Browse files Browse the repository at this point in the history
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
  • Loading branch information
CommanderRoot authored and wraithgar committed Apr 5, 2022
1 parent 9a0ec63 commit e307e17
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const parseArg = arg => {
const k = split.shift()
const v = split.join('=')
const no = /^no-/.test(k) && !v
const key = (no ? k.substr(3) : k)
const key = (no ? k.slice(3) : k)
.replace(/^tag$/, 'defaultTag')
.replace(/-([a-z])/g, (_, c) => c.toUpperCase())
const value = v ? v.replace(/^~/, process.env.HOME) : !no
Expand Down
2 changes: 1 addition & 1 deletion lib/util/trailing-slashes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const removeTrailingSlashes = (input) => {
// in order to avoid regexp redos detection
let output = input
while (output.endsWith('/')) {
output = output.substr(0, output.length - 1)
output = output.slice(0, -1)
}
return output
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/abbrev/abbrev.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function abbrev (list) {
abbrevs[current] = current
continue
}
for (var a = current.substr(0, j); j <= cl; j++) {
for (var a = current.slice(0, j); j <= cl; j++) {
abbrevs[a] = current
a += current.charAt(j)
}
Expand Down

0 comments on commit e307e17

Please sign in to comment.