Skip to content

Commit 95e3e26

Browse files
committed
Revert "refactor(core): optimize calls to split and slice while computing version parts (angular#41208)"
This reverts commit 744bd2b. This commit seems to cause issues in Safari.
1 parent f66c9ae commit 95e3e26

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

packages/animations/src/version.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ export class Version {
2323
public readonly patch: string;
2424

2525
constructor(public full: string) {
26-
const [major, minor, ...rest] = full.split('.');
27-
this.major = major;
28-
this.minor = minor;
29-
this.patch = rest.join('.');
26+
const splits = full.split('.');
27+
this.major = splits[0];
28+
this.minor = splits[1];
29+
this.patch = splits.slice(2).join('.');
3030
}
3131
}
3232

packages/compiler/src/util.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,10 @@ export class Version {
236236
public readonly patch: string;
237237

238238
constructor(public full: string) {
239-
const [major, minor, ...rest] = full.split('.');
240-
this.major = major;
241-
this.minor = minor;
242-
this.patch = rest.join('.');
239+
const splits = full.split('.');
240+
this.major = splits[0];
241+
this.minor = splits[1];
242+
this.patch = splits.slice(2).join('.');
243243
}
244244
}
245245

packages/core/src/version.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ export class Version {
1717
public readonly patch: string;
1818

1919
constructor(public full: string) {
20-
const [major, minor, ...rest] = full.split('.');
21-
this.major = major;
22-
this.minor = minor;
23-
this.patch = rest.join('.');
20+
this.major = full.split('.')[0];
21+
this.minor = full.split('.')[1];
22+
this.patch = full.split('.').slice(2).join('.');
2423
}
2524
}
2625

0 commit comments

Comments
 (0)