Skip to content

Commit 2d60579

Browse files
CommanderRootMichael Mok
authored and
Michael Mok
committed
chore: replace deprecated String.prototype.substr() (webpack#4343)
1 parent e67f483 commit 2d60579

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

client-src/utils/createSocketURL.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
function format(objURL) {
66
let protocol = objURL.protocol || "";
77

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

client-src/utils/parseURL.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function parseURL(resourceQuery) {
99
let options = {};
1010

1111
if (typeof resourceQuery === "string" && resourceQuery !== "") {
12-
const searchParams = resourceQuery.substr(1).split("&");
12+
const searchParams = resourceQuery.slice(1).split("&");
1313

1414
for (let i = 0; i < searchParams.length; i++) {
1515
const pair = searchParams[i].split("=");

test/e2e/range-header.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe("'Range' header", () => {
4242
);
4343
expect(responseRange.headers["content-length"]).toBe("500");
4444
expect(responseRange.headers["content-range"]).toMatch(/^bytes 0-499\//);
45-
expect(responseRange.text).toBe(responseContent.substr(0, 500));
45+
expect(responseRange.text).toBe(responseContent.slice(0, 500));
4646
expect(responseRange.text.length).toBe(500);
4747
});
4848

0 commit comments

Comments
 (0)