Revert "refactor(core): optimize calls to `split` and `slice` while computing version parts (#41208)"

This reverts commit 744bd2b64f.

This commit seems to cause issues in Safari.
This commit is contained in:
Alex Rickabaugh 2021-05-12 14:13:50 -04:00
parent eac42e9889
commit a74eb52589
3 changed files with 11 additions and 12 deletions

View File

@ -23,10 +23,10 @@ export class Version {
public readonly patch: string; public readonly patch: string;
constructor(public full: string) { constructor(public full: string) {
const [major, minor, ...rest] = full.split('.'); const splits = full.split('.');
this.major = major; this.major = splits[0];
this.minor = minor; this.minor = splits[1];
this.patch = rest.join('.'); this.patch = splits.slice(2).join('.');
} }
} }

View File

@ -236,10 +236,10 @@ export class Version {
public readonly patch: string; public readonly patch: string;
constructor(public full: string) { constructor(public full: string) {
const [major, minor, ...rest] = full.split('.'); const splits = full.split('.');
this.major = major; this.major = splits[0];
this.minor = minor; this.minor = splits[1];
this.patch = rest.join('.'); this.patch = splits.slice(2).join('.');
} }
} }

View File

@ -17,10 +17,9 @@ export class Version {
public readonly patch: string; public readonly patch: string;
constructor(public full: string) { constructor(public full: string) {
const [major, minor, ...rest] = full.split('.'); this.major = full.split('.')[0];
this.major = major; this.minor = full.split('.')[1];
this.minor = minor; this.patch = full.split('.').slice(2).join('.');
this.patch = rest.join('.');
} }
} }