minotor 11.5.1 → 12.0.0

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.
@@ -23,7 +23,21 @@ export type PickUpDropOffType =
23
23
 
24
24
  export type PickUpDropOffTypeString = keyof typeof PickUpDropOffTypes;
25
25
 
26
- export type RawPickUpDropOffType = PickUpDropOffType;
26
+ /** Returns the identifier name for a pickup/drop-off type. */
27
+ export const pickUpDropOffTypeToString = (
28
+ type: PickUpDropOffType,
29
+ ): PickUpDropOffTypeString => {
30
+ switch (type) {
31
+ case PickUpDropOffTypes.REGULAR:
32
+ return 'REGULAR';
33
+ case PickUpDropOffTypes.NOT_AVAILABLE:
34
+ return 'NOT_AVAILABLE';
35
+ case PickUpDropOffTypes.MUST_PHONE_AGENCY:
36
+ return 'MUST_PHONE_AGENCY';
37
+ case PickUpDropOffTypes.MUST_COORDINATE_WITH_DRIVER:
38
+ return 'MUST_COORDINATE_WITH_DRIVER';
39
+ }
40
+ };
27
41
 
28
42
  /*
29
43
  * A trip route index corresponds to the index of a given trip in a route.
@@ -323,7 +337,7 @@ export class Route {
323
337
  dropOffTypeAtOffset(
324
338
  stopIndex: StopRouteIndex,
325
339
  offset: number,
326
- ): RawPickUpDropOffType {
340
+ ): PickUpDropOffType {
327
341
  const globalIndex = offset + stopIndex;
328
342
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
329
343
  const byte = this.pickupDropOffTypes[globalIndex >> 1]!;
@@ -331,7 +345,7 @@ export class Route {
331
345
  // First pair → drop-off in lower 2 bits; second pair → drop-off in bits 4-5.
332
346
  return (
333
347
  globalIndex & 1 ? (byte >> 4) & 0x03 : byte & 0x03
334
- ) as RawPickUpDropOffType;
348
+ ) as PickUpDropOffType;
335
349
  }
336
350
 
337
351
  /**
@@ -362,7 +376,7 @@ export class Route {
362
376
  pickUpTypeFrom(
363
377
  stopIndex: StopRouteIndex,
364
378
  tripIndex: TripRouteIndex,
365
- ): RawPickUpDropOffType {
379
+ ): PickUpDropOffType {
366
380
  const globalIndex = tripIndex * this.stops.length + stopIndex;
367
381
  const byteIndex = globalIndex >> 1;
368
382
  const isSecondPair = (globalIndex & 1) === 1;
@@ -377,7 +391,7 @@ export class Route {
377
391
  const pickUpValue = isSecondPair
378
392
  ? (byte >> 6) & 0x03 // Upper 2 bits for second pair
379
393
  : (byte >> 2) & 0x03; // Bits 2-3 for first pair
380
- return pickUpValue as RawPickUpDropOffType;
394
+ return pickUpValue as PickUpDropOffType;
381
395
  }
382
396
 
383
397
  /**
@@ -390,7 +404,7 @@ export class Route {
390
404
  dropOffTypeAt(
391
405
  stopIndex: StopRouteIndex,
392
406
  tripIndex: TripRouteIndex,
393
- ): RawPickUpDropOffType {
407
+ ): PickUpDropOffType {
394
408
  const globalIndex = tripIndex * this.stops.length + stopIndex;
395
409
  const byteIndex = globalIndex >> 1;
396
410
  const isSecondPair = (globalIndex & 1) === 1;
@@ -405,7 +419,7 @@ export class Route {
405
419
  const dropOffValue = isSecondPair
406
420
  ? (byte >> 4) & 0x03 // Bits 4-5 for second pair
407
421
  : byte & 0x03; // Lower 2 bits for first pair
408
- return dropOffValue as RawPickUpDropOffType;
422
+ return dropOffValue as PickUpDropOffType;
409
423
  }
410
424
 
411
425
  /**