Skip to content

Commit

Permalink
Merge pull request #42 from CommanderRoot/rm-deprecated-substr
Browse files Browse the repository at this point in the history
Replace deprecated String.prototype.substr()
  • Loading branch information
wesleytodd authored Jul 26, 2024
2 parents ed7166d + 3e8c82a commit adab325
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 adab325

Please sign in to comment.