turf-common 1.2.1-beta.47 → 1.2.1-beta.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ export declare class TurfAvailability implements ITurfAvailability {
24
24
  endDateCode: string;
25
25
  fromTimeCode: string;
26
26
  toTimeCode: string;
27
- pitchIdCodes: string[];
27
+ pitchCodes: string[];
28
28
  constructor(data: IGetAvailabilityByTurf);
29
29
  getTotalAvailablePrice(): number;
30
30
  getTotalNonAvailablePrice(): number;
@@ -43,5 +43,12 @@ export declare class TurfAvailability implements ITurfAvailability {
43
43
  getTotalTime(): number;
44
44
  getCode(): string;
45
45
  parse(): void;
46
+ static parse(eventCode: string): {
47
+ pitchCodes: string[];
48
+ startDateCode: string;
49
+ endDateCode: string;
50
+ fromTimeCode: string;
51
+ toTimeCode: string;
52
+ };
46
53
  }
47
54
  export {};
@@ -179,14 +179,24 @@ var TurfAvailability = /** @class */ (function () {
179
179
  var eventCodes = eventCode.split("#");
180
180
  var dateCodeRange = eventCodes[1];
181
181
  var timeCodeRange = eventCodes[2];
182
- this.pitchIdCodes = eventCodes[3]
183
- .split(",")
184
- .map(function (id) { return id.padStart(2, "0"); });
182
+ this.pitchCodes = eventCodes[3].split(",").map(function (id) { return id.padStart(2, "0"); });
185
183
  this.startDateCode = dateCodeRange.slice(0, 6);
186
184
  this.endDateCode = dateCodeRange.slice(6, 12);
187
185
  this.fromTimeCode = timeCodeRange.slice(0, 4);
188
186
  this.toTimeCode = timeCodeRange.slice(4, 8);
189
187
  };
188
+ TurfAvailability.parse = function (eventCode) {
189
+ var eventCodes = eventCode.split("#");
190
+ var dateCodeRange = eventCodes[1];
191
+ var timeCodeRange = eventCodes[2];
192
+ return {
193
+ pitchCodes: eventCodes[3].split(",").map(function (id) { return id.padStart(2, "0"); }),
194
+ startDateCode: dateCodeRange.slice(0, 6),
195
+ endDateCode: dateCodeRange.slice(6, 12),
196
+ fromTimeCode: timeCodeRange.slice(0, 4),
197
+ toTimeCode: timeCodeRange.slice(4, 8),
198
+ };
199
+ };
190
200
  return TurfAvailability;
191
201
  }());
192
202
  exports.TurfAvailability = TurfAvailability;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.2.1-beta.47",
3
+ "version": "1.2.1-beta.49",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",