1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-07 21:23:00 +03:00

Replace deprecated String#substr with String#slice (#8314)

This commit is contained in:
CommanderRoot
2022-04-14 09:52:42 +02:00
committed by GitHub
parent 0e68c16a90
commit c35fc169f5
17 changed files with 37 additions and 37 deletions

View File

@@ -59,7 +59,7 @@ describe("PosthogAnalytics", () => {
const hexHash = shaHashes[message];
const bytes = [];
for (let c = 0; c < hexHash.length; c += 2) {
bytes.push(parseInt(hexHash.substr(c, 2), 16));
bytes.push(parseInt(hexHash.slice(c, c + 2), 16));
}
return bytes as unknown as ArrayBuffer;
},

View File

@@ -199,8 +199,8 @@ describe('MemberList', () => {
}
if (!groupChange) {
const nameA = memberA.name[0] === '@' ? memberA.name.substr(1) : memberA.name;
const nameB = memberB.name[0] === '@' ? memberB.name.substr(1) : memberB.name;
const nameA = memberA.name[0] === '@' ? memberA.name.slice(1) : memberA.name;
const nameB = memberB.name[0] === '@' ? memberB.name.slice(1) : memberB.name;
const nameCompare = compare(nameB, nameA);
console.log("Comparing name");
expect(nameCompare).toBeGreaterThanOrEqual(0);

View File

@@ -42,7 +42,7 @@ export class RestSession {
}
userName(): string {
return this.credentials.userId.split(":")[0].substr(1);
return this.credentials.userId.split(":")[0].slice(1);
}
displayName(): string {