turf-common 1.2.1-beta.46 → 1.2.1-beta.48

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,6 +24,7 @@ export declare class TurfAvailability implements ITurfAvailability {
24
24
  endDateCode: string;
25
25
  fromTimeCode: string;
26
26
  toTimeCode: string;
27
+ pitchIdCodes: string[];
27
28
  constructor(data: IGetAvailabilityByTurf);
28
29
  getTotalAvailablePrice(): number;
29
30
  getTotalNonAvailablePrice(): number;
@@ -42,5 +43,12 @@ export declare class TurfAvailability implements ITurfAvailability {
42
43
  getTotalTime(): number;
43
44
  getCode(): string;
44
45
  parse(): void;
46
+ static parse(eventCode: string): {
47
+ pitchIdCodes: string[];
48
+ startDateCode: string;
49
+ endDateCode: string;
50
+ fromTimeCode: string;
51
+ toTimeCode: string;
52
+ };
45
53
  }
46
54
  export {};
@@ -179,11 +179,26 @@ 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
185
  this.startDateCode = dateCodeRange.slice(0, 6);
183
186
  this.endDateCode = dateCodeRange.slice(6, 12);
184
187
  this.fromTimeCode = timeCodeRange.slice(0, 4);
185
188
  this.toTimeCode = timeCodeRange.slice(4, 8);
186
189
  };
190
+ TurfAvailability.parse = function (eventCode) {
191
+ var eventCodes = eventCode.split("#");
192
+ var dateCodeRange = eventCodes[1];
193
+ var timeCodeRange = eventCodes[2];
194
+ return {
195
+ pitchIdCodes: eventCodes[3].split(",").map(function (id) { return id.padStart(2, "0"); }),
196
+ startDateCode: dateCodeRange.slice(0, 6),
197
+ endDateCode: dateCodeRange.slice(6, 12),
198
+ fromTimeCode: timeCodeRange.slice(0, 4),
199
+ toTimeCode: timeCodeRange.slice(4, 8),
200
+ };
201
+ };
187
202
  return TurfAvailability;
188
203
  }());
189
204
  exports.TurfAvailability = TurfAvailability;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.2.1-beta.46",
3
+ "version": "1.2.1-beta.48",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",