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 <rootcommander@gmail.com>
  • Loading branch information
CommanderRoot authored and wesleytodd committed Aug 31, 2024
1 parent 8dec753 commit d3c7697
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/mediaType.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function parseMediaType(str, i) {

// get the value, unwrapping quotes
var value = val && val[0] === '"' && val[val.length - 1] === '"'
? val.substr(1, val.length - 2)
? val.slice(1, -1)
: val;

if (key === 'q') {
Expand Down Expand Up @@ -238,8 +238,8 @@ function splitKeyValuePair(str) {
if (index === -1) {
key = str;
} else {
key = str.substr(0, index);
val = str.substr(index + 1);
key = str.slice(0, index);
val = str.slice(index + 1);
}

return [key, val];
Expand Down

0 comments on commit d3c7697

Please sign in to comment.