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>
This commit is contained in:
Tobias Speicher
2022-03-20 05:52:04 +01:00
committed by Henry Mercer
parent 72aa4f0561
commit 2d1707db00
2 changed files with 3 additions and 3 deletions

View File

@@ -1106,8 +1106,8 @@ class SplitBuffer {
while (this.searchIndex <= (this.buffer.length - this.maxSeparatorLength)) {
for (const separator of this.separators) {
if (SplitBuffer.startsWith(this.buffer, separator, this.searchIndex)) {
const line = this.buffer.substr(0, this.searchIndex);
this.buffer = this.buffer.substr(this.searchIndex + separator.length);
const line = this.buffer.slice(0, this.searchIndex);
this.buffer = this.buffer.slice(this.searchIndex + separator.length);
this.searchIndex = 0;
return line;
}

View File

@@ -76,7 +76,7 @@ export class QLTestAdapterFactory extends DisposableObject {
* @param ext The new extension, including the `.`.
*/
function changeExtension(p: string, ext: string): string {
return p.substr(0, p.length - path.extname(p).length) + ext;
return p.slice(0, -path.extname(p).length) + ext;
}
/**