Skip to content

Commit

Permalink
chore: replace deprecated String.prototype.substr() (#4343)
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderRoot committed Mar 18, 2022
1 parent 1bf2614 commit a7ccab1
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
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
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
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 a7ccab1

Please sign in to comment.