From a74eb5258985722b004f77d63459382361009449 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Wed, 12 May 2021 14:13:50 -0400 Subject: [PATCH] Revert "refactor(core): optimize calls to `split` and `slice` while computing version parts (#41208)" This reverts commit 744bd2b64f6dd2e7b25cbc0bedd03abc3f59d264. This commit seems to cause issues in Safari. --- packages/animations/src/version.ts | 8 ++++---- packages/compiler/src/util.ts | 8 ++++---- packages/core/src/version.ts | 7 +++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/animations/src/version.ts b/packages/animations/src/version.ts index ce0a0cd10e..3eca0eb3c8 100644 --- a/packages/animations/src/version.ts +++ b/packages/animations/src/version.ts @@ -23,10 +23,10 @@ export class Version { public readonly patch: string; constructor(public full: string) { - const [major, minor, ...rest] = full.split('.'); - this.major = major; - this.minor = minor; - this.patch = rest.join('.'); + const splits = full.split('.'); + this.major = splits[0]; + this.minor = splits[1]; + this.patch = splits.slice(2).join('.'); } } diff --git a/packages/compiler/src/util.ts b/packages/compiler/src/util.ts index 57fa10fae9..8c62653f09 100644 --- a/packages/compiler/src/util.ts +++ b/packages/compiler/src/util.ts @@ -236,10 +236,10 @@ export class Version { public readonly patch: string; constructor(public full: string) { - const [major, minor, ...rest] = full.split('.'); - this.major = major; - this.minor = minor; - this.patch = rest.join('.'); + const splits = full.split('.'); + this.major = splits[0]; + this.minor = splits[1]; + this.patch = splits.slice(2).join('.'); } } diff --git a/packages/core/src/version.ts b/packages/core/src/version.ts index aea151d90c..71a5cb8878 100644 --- a/packages/core/src/version.ts +++ b/packages/core/src/version.ts @@ -17,10 +17,9 @@ export class Version { public readonly patch: string; constructor(public full: string) { - const [major, minor, ...rest] = full.split('.'); - this.major = major; - this.minor = minor; - this.patch = rest.join('.'); + this.major = full.split('.')[0]; + this.minor = full.split('.')[1]; + this.patch = full.split('.').slice(2).join('.'); } }