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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 37 additions and 37 deletions

View file

@ -97,7 +97,7 @@ function parseCodeBlock(n: Node, pc: PartCreator): Part[] {
if (n.firstChild?.nodeName === "CODE") {
for (const className of (n.firstChild as HTMLElement).classList) {
if (className.startsWith("language-") && !className.startsWith("language-_")) {
language = className.substr("language-".length);
language = className.slice("language-".length);
break;
}
}
@ -118,7 +118,7 @@ function parseCodeBlock(n: Node, pc: PartCreator): Part[] {
}
function parseHeader(n: Node, pc: PartCreator): Part[] {
const depth = parseInt(n.nodeName.substr(1), 10);
const depth = parseInt(n.nodeName.slice(1), 10);
const prefix = pc.plain("#".repeat(depth) + " ");
return [prefix, ...parseChildren(n, pc)];
}