bus-mj 2.2.7 → 2.2.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/getBus.js +3 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bus-mj",
3
- "version": "2.2.7",
3
+ "version": "2.2.8",
4
4
  "description": "package for BUS station in Mahajanga",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/getBus.js CHANGED
@@ -86,7 +86,7 @@ export function __findBusByStopLabel(stop_label, relations, beginLabel) {
86
86
  (m) => m.label?.toUpperCase() === beginLabel.toUpperCase()
87
87
  );
88
88
 
89
- const endIndex = rel.members.findIndex(
89
+ const endIndex = rel.members.findLastIndex(
90
90
  (m) => m.label?.toUpperCase() === stop_label.toUpperCase()
91
91
  );
92
92
 
@@ -94,15 +94,12 @@ export function __findBusByStopLabel(stop_label, relations, beginLabel) {
94
94
  return null;
95
95
  }
96
96
 
97
- const start = Math.min(beginIndex, endIndex);
98
- const end = Math.max(beginIndex, endIndex);
99
-
100
97
  return {
101
98
  ...rel,
102
- members: rel.members.slice(start, end + 1),
99
+ members: rel.members.slice(beginIndex, endIndex + 1),
103
100
  };
104
101
  })
105
- .filter(Boolean);
102
+ .filter((bus) => bus !== null && bus.members.length > 0);
106
103
  }
107
104
 
108
105
  /**