From 1e3688ca04a8a468a85e4738e2366403985c801b Mon Sep 17 00:00:00 2001 From: Franco Speziali Date: Wed, 23 Mar 2022 10:34:39 +0100 Subject: [PATCH] Some renamed groupTypes => groupType as this references a single groupType --- src/Calendar/index.ts | 4 ++-- src/Config/Config.ts | 6 +++--- src/EventGrouping/index.ts | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Calendar/index.ts b/src/Calendar/index.ts index cfe2a45..28f199a 100644 --- a/src/Calendar/index.ts +++ b/src/Calendar/index.ts @@ -12,12 +12,12 @@ export default class Calendar { constructor(json) { this.jsonContent = json; this.config = new Config({ - groupTypes: json["group"] ? json["group"].charAt(0) : GroupTypes.Day, + groupType: json["group"] ? json["group"].charAt(0) : GroupTypes.Day, }); this.events = new Events(json["events"]); this.eventGrouping = new EventGrouping( this.events.sortedEvents, - this.config.groupTypes + this.config.groupType ); } } diff --git a/src/Config/Config.ts b/src/Config/Config.ts index 60c7298..b5be1bc 100644 --- a/src/Config/Config.ts +++ b/src/Config/Config.ts @@ -1,9 +1,9 @@ import { GroupTypes } from "../types"; export default class Config { - groupTypes: GroupTypes; + groupType: GroupTypes; - constructor({ groupTypes }) { - this.groupTypes = groupTypes.toUpperCase(); + constructor({ groupType }) { + this.groupType = groupType.toUpperCase(); } } diff --git a/src/EventGrouping/index.ts b/src/EventGrouping/index.ts index ea80eb9..48b390d 100644 --- a/src/EventGrouping/index.ts +++ b/src/EventGrouping/index.ts @@ -11,7 +11,7 @@ export default class EventGrouping { private readonly sortedEvents: Event[]; private readonly firstEvent: Event; private readonly lastEvent: Event; - public readonly groupTypes: GroupTypes; + public readonly groupType: GroupTypes; public readonly groups: Groups; public static generateEmptyGroups(length: number): Groups { @@ -24,16 +24,16 @@ export default class EventGrouping { return groups; } - constructor(sortedEvents: Event[], groupTypes: GroupTypes) { + constructor(sortedEvents: Event[], groupType: GroupTypes) { this.sortedEvents = sortedEvents; this.firstEvent = this.sortedEvents[0]; this.lastEvent = this.sortedEvents[this.sortedEvents.length - 1]; - this.groupTypes = groupTypes; - this.groups = this.group(groupTypes); + this.groupType = groupType; + this.groups = this.group(groupType); } - private group(groupTypes: GroupTypes): Groups { - switch (groupTypes) { + private group(groupType: GroupTypes): Groups { + switch (groupType) { case GroupTypes.Day: return this.byDay(); case GroupTypes.Week: @@ -100,7 +100,7 @@ export default class EventGrouping { public getDateFromGroupIndex(index: number): Date { const startDate = this.firstEvent.date; - switch (this.groupTypes) { + switch (this.groupType) { case GroupTypes.Day: return add(startDate, { days: index }); case GroupTypes.Week: