Skip to content

Commit

Permalink
chore: 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 18, 2022
1 parent 188497a commit 5d99468
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client-src/utils/createSocketURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
function format(objURL) {
let protocol = objURL.protocol || "";

if (protocol && protocol.substr(-1) !== ":") {
if (protocol && !protocol.endsWith(":")) {
protocol += ":";
}

Expand Down
2 changes: 1 addition & 1 deletion client-src/utils/parseURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function parseURL(resourceQuery) {
let options = {};

if (typeof resourceQuery === "string" && resourceQuery !== "") {
const searchParams = resourceQuery.substr(1).split("&");
const searchParams = resourceQuery.slice(1).split("&");

for (let i = 0; i < searchParams.length; i++) {
const pair = searchParams[i].split("=");
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/range-header.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("'Range' header", () => {
);
expect(responseRange.headers["content-length"]).toBe("500");
expect(responseRange.headers["content-range"]).toMatch(/^bytes 0-499\//);
expect(responseRange.text).toBe(responseContent.substr(0, 500));
expect(responseRange.text).toBe(responseContent.slice(0, 500));
expect(responseRange.text.length).toBe(500);
});

Expand Down

0 comments on commit 5d99468

Please sign in to comment.