diff --git a/packages/animations/src/version.ts b/packages/animations/src/version.ts index 3eca0eb3c8..ce0a0cd10e 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 splits = full.split('.'); - this.major = splits[0]; - this.minor = splits[1]; - this.patch = splits.slice(2).join('.'); + const [major, minor, ...rest] = full.split('.'); + this.major = major; + this.minor = minor; + this.patch = rest.join('.'); } } diff --git a/packages/compiler/src/util.ts b/packages/compiler/src/util.ts index 8c62653f09..57fa10fae9 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 splits = full.split('.'); - this.major = splits[0]; - this.minor = splits[1]; - this.patch = splits.slice(2).join('.'); + const [major, minor, ...rest] = full.split('.'); + this.major = major; + this.minor = minor; + this.patch = rest.join('.'); } } diff --git a/packages/core/src/version.ts b/packages/core/src/version.ts index 71a5cb8878..aea151d90c 100644 --- a/packages/core/src/version.ts +++ b/packages/core/src/version.ts @@ -17,9 +17,10 @@ export class Version { public readonly patch: string; constructor(public full: string) { - this.major = full.split('.')[0]; - this.minor = full.split('.')[1]; - this.patch = full.split('.').slice(2).join('.'); + const [major, minor, ...rest] = full.split('.'); + this.major = major; + this.minor = minor; + this.patch = rest.join('.'); } }