Skip to content

Commit 8c9a20f

Browse files
refactor: replace deprecated String.prototype.substr() (#24628)
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <[email protected]>
1 parent e2e8e11 commit 8c9a20f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

scripts/create-legacy-tests-bundle.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ async function createResolveEsbuildPlugin() {
152152
name: 'ng-resolve-esbuild',
153153
setup: build => {
154154
build.onResolve({filter: /@angular\//}, async args => {
155-
const pkgName = args.path.substr('@angular/'.length);
155+
const pkgName = args.path.slice('@angular/'.length);
156156
let resolvedPath = join(legacyOutputDir, pkgName);
157157
let stats = await statGraceful(resolvedPath);
158158

src/circular-deps-test.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = {
2525
*/
2626
function resolveModule(specifier) {
2727
if (specifier.startsWith('@angular/')) {
28-
return path.join(__dirname, specifier.substr('@angular/'.length));
28+
return path.join(__dirname, specifier.slice('@angular/'.length));
2929
}
3030
return null;
3131
}

tools/markdown-to-html/docs-marked-renderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class DocsMarkdownRenderer extends Renderer {
4848

4949
// Keep track of all fragments discovered in a file.
5050
if (href.startsWith('#')) {
51-
this._referencedFragments.add(href.substr(1));
51+
this._referencedFragments.add(href.slice(1));
5252
}
5353

5454
return super.link(href, title, text);

tools/region-parser/region-parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,5 @@ function leftAlign(lines: string[]): string[] {
126126
indent = Math.min(lineIndent, indent);
127127
}
128128
});
129-
return lines.map(line => line.substr(indent));
129+
return lines.map(line => line.slice(indent));
130130
}

0 commit comments

Comments
 (0)