Skip to content

Commit 2d1707d

Browse files
CommanderRoothenrymercer
authored andcommitted
refactor: replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
1 parent 72aa4f0 commit 2d1707d

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

extensions/ql-vscode/src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,8 +1106,8 @@ class SplitBuffer {
11061106
while (this.searchIndex <= (this.buffer.length - this.maxSeparatorLength)) {
11071107
for (const separator of this.separators) {
11081108
if (SplitBuffer.startsWith(this.buffer, separator, this.searchIndex)) {
1109-
const line = this.buffer.substr(0, this.searchIndex);
1110-
this.buffer = this.buffer.substr(this.searchIndex + separator.length);
1109+
const line = this.buffer.slice(0, this.searchIndex);
1110+
this.buffer = this.buffer.slice(this.searchIndex + separator.length);
11111111
this.searchIndex = 0;
11121112
return line;
11131113
}

extensions/ql-vscode/src/test-adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class QLTestAdapterFactory extends DisposableObject {
7676
* @param ext The new extension, including the `.`.
7777
*/
7878
function changeExtension(p: string, ext: string): string {
79-
return p.substr(0, p.length - path.extname(p).length) + ext;
79+
return p.slice(0, -path.extname(p).length) + ext;
8080
}
8181

8282
/**

0 commit comments

Comments
 (0)