mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor: replace deprecated String.prototype.substr() (#45397)
.substr() is deprecated so we replace it with functions which work similarily but aren't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com> PR Close #45397
This commit is contained in:
committed by
Dylan Hunn
parent
0f9b3c67b4
commit
4ddcf81e61
@@ -7,7 +7,7 @@ import {SHORT_SHA_LEN} from './constants';
|
||||
* @param sha The SHA to shorten.
|
||||
*/
|
||||
export function computeShortSha(sha: string) {
|
||||
return sha.substr(0, SHORT_SHA_LEN);
|
||||
return sha.slice(0, SHORT_SHA_LEN);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import {customAsyncMatchers} from './jasmine-custom-async-matchers';
|
||||
describe('BuildCreator', () => {
|
||||
const pr = 9;
|
||||
const sha = '9'.repeat(40);
|
||||
const shortSha = sha.substr(0, SHORT_SHA_LEN);
|
||||
const shortSha = sha.slice(0, SHORT_SHA_LEN);
|
||||
const archive = 'snapshot.tar.gz';
|
||||
const buildsDir = 'builds/dir';
|
||||
const hiddenPrDir = path.join(buildsDir, `hidden--${pr}`);
|
||||
|
||||
Reference in New Issue
Block a user