Skip to content

Commit

Permalink
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 <[email protected]>
  • Loading branch information
CommanderRoot committed Mar 21, 2022
1 parent 73bf21e commit 3e8c82a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function format (obj) {
for (var i = 0; i < params.length; i++) {
param = params[i]

var val = param.substr(-1) === '*'
var val = param.slice(-1) === '*'
? ustring(parameters[param])
: qstring(parameters[param])

Expand Down Expand Up @@ -332,7 +332,7 @@ function parse (string) {
var value

// calculate index to start at
index = PARAM_REGEXP.lastIndex = match[0].substr(-1) === ';'
index = PARAM_REGEXP.lastIndex = match[0].slice(-1) === ';'
? index - 1
: index

Expand Down Expand Up @@ -369,7 +369,7 @@ function parse (string) {
if (value[0] === '"') {
// remove quotes and escapes
value = value
.substr(1, value.length - 2)
.slice(1, -1)
.replace(QESC_REGEXP, '$1')
}

Expand Down

0 comments on commit 3e8c82a

Please sign in to comment.