@transportme/load-ptv-gtfs 1.4.20 → 1.4.22

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.
@@ -51,7 +51,7 @@ export default class GTFSTrip {
51
51
  * @returns {GTFSTrip} A trip instance representing the data being passed in
52
52
  */
53
53
  static create(data, mode) {
54
- let types = [ SmartrakTrip, MetroTrip, GTFSTrip ]
54
+ let types = [ SmartrakTrip, IdentifiableTrip, GTFSTrip ]
55
55
  for (let type of types) {
56
56
  if (type.canProcess(data, mode)) return new type(data)
57
57
  }
@@ -157,19 +157,19 @@ export class SmartrakTrip extends GTFSTrip {
157
157
  * Example: 02-BEG--58-T5_n4-3651
158
158
  * RRB Example: 02-SUY--13-T2-BS000
159
159
  */
160
- export class MetroTrip extends GTFSTrip {
160
+ export class IdentifiableTrip extends GTFSTrip {
161
161
 
162
162
  #runID
163
163
 
164
164
  constructor(data) {
165
165
  super(data)
166
166
 
167
- let runID = data.id.match(/^02-\w{3}-.*-(\w{1,2}\d{2,3})$/)
167
+ let runID = data.id.match(/^\d\d-\w{1,3}-.*-(\w+)$/)
168
168
  this.#runID = runID[1]
169
169
  }
170
170
 
171
- static canProcess(data, mode) {
172
- return mode === TRANSIT_MODES.metroTrain && data.id.match(/^02-\w{3}-.*-(\w{1,2}\d{2,3})$/)
171
+ static canProcess(data) {
172
+ return !!data.id.match(/^\d\d-\w{1,3}-.*-(\w+)$/)
173
173
  }
174
174
 
175
175
  getTrainDirection() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transportme/load-ptv-gtfs",
3
- "version": "1.4.20",
3
+ "version": "1.4.22",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "scripts": {