bus-mj 2.2.1 → 2.2.3

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.
package/data/nodes.js CHANGED
@@ -170,7 +170,7 @@ export default [
170
170
  "id": 11031963685,
171
171
  "lat": -15.7173625,
172
172
  "lon": 46.3225145,
173
- "label": "Bain_douche"
173
+ "label": "Bain douche"
174
174
  },
175
175
  {
176
176
  "type": "node",
@@ -280,7 +280,7 @@ export default [
280
280
  "id": 11029704990,
281
281
  "lat": -15.7072161,
282
282
  "lon": 46.3124853,
283
- "label": "Bar_Sofa"
283
+ "label": "Bar Sofa"
284
284
  },
285
285
  {
286
286
  "type": "node",
@@ -459,7 +459,7 @@ export default [
459
459
  "id": 11027750437,
460
460
  "lat": -15.7184238,
461
461
  "lon": 46.3166675,
462
- "label": "Hotel de Ville"
462
+ "label": "Hôtel de Ville"
463
463
  },
464
464
  {
465
465
  "type": "node",
@@ -695,7 +695,7 @@ export default [
695
695
  "id": 11029976164,
696
696
  "lat": -15.723803,
697
697
  "lon": 46.3106776,
698
- "label": "Bazar Be"
698
+ "label": "Bazary Be"
699
699
  },
700
700
  {
701
701
  "type": "node",
@@ -1029,7 +1029,7 @@ export default [
1029
1029
  "id": 11032282188,
1030
1030
  "lat": -15.7184704,
1031
1031
  "lon": 46.3171848,
1032
- "label": "Hotel de ville"
1032
+ "label": "Hôtel de Ville"
1033
1033
  },
1034
1034
  {
1035
1035
  "type": "node",
@@ -1375,7 +1375,7 @@ export default [
1375
1375
  "id": 11029976154,
1376
1376
  "lat": -15.7186046,
1377
1377
  "lon": 46.3164436,
1378
- "label": "Hotel de ville"
1378
+ "label": "Hôtel de Ville"
1379
1379
  },
1380
1380
  {
1381
1381
  "type": "node",
@@ -1845,7 +1845,7 @@ export default [
1845
1845
  "id": 11033858714,
1846
1846
  "lat": -15.7169456,
1847
1847
  "lon": 46.3171033,
1848
- "label": "Hotel de Ville"
1848
+ "label": "Hôtel de Ville"
1849
1849
  },
1850
1850
  {
1851
1851
  "type": "node",
@@ -1880,7 +1880,7 @@ export default [
1880
1880
  "id": 11027750433,
1881
1881
  "lat": -15.7238554,
1882
1882
  "lon": 46.3105541,
1883
- "label": "Bazar Be"
1883
+ "label": "Bazary Be"
1884
1884
  },
1885
1885
  {
1886
1886
  "type": "node",
package/index.d.ts CHANGED
@@ -28,12 +28,15 @@ type Stop = {
28
28
  label: string | null,
29
29
  }
30
30
 
31
+ export function findBusAll(): Bus[];
31
32
  export function findStopAll(): Stop[];
33
+ export function findBusDetailById(busId: number): Bus;
32
34
  export function findBusByOneStop(stopId: number): Bus[];
33
35
  export function findBusByTwoStop(startStopId: number, endStopId: number): Bus[];
34
- export function findBusDetailById(busId: number): Bus;
35
- export function findBusAll(): Bus[];
36
36
  export function findOperatorAll(): string[];
37
37
  export function findZoneAll(): string[];
38
38
  export function findBusDetailByOperator(operatorName: string): Bus[];
39
- export function findOpenHoursAll(): string[];
39
+ export function findOpenHoursAll(): string[];
40
+ export function findStopByRef(ref: number): Stop;
41
+ export function findBusByStopLabel(label: string): Bus[];
42
+ export function findBusByTwoStopLabel(begin: string, end: string): Bus[];
package/index.js CHANGED
@@ -1,23 +1,29 @@
1
1
  import {
2
+ findBusAll,
2
3
  findStopAll,
4
+ findBusDetailById,
3
5
  findBusByOneStop,
4
6
  findBusByTwoStop,
5
- findBusDetailById,
6
- findBusAll,
7
7
  findOperatorAll,
8
8
  findZoneAll,
9
9
  findBusDetailByOperator,
10
- findOpenHoursAll
10
+ findOpenHoursAll,
11
+ findStopByRef,
12
+ findBusByStopLabel,
13
+ findBusByTwoStopLabel
11
14
  } from "./src/getBus.js";
12
15
 
13
16
  export {
17
+ findBusAll,
14
18
  findStopAll,
19
+ findBusDetailById,
15
20
  findBusByOneStop,
16
21
  findBusByTwoStop,
17
- findBusDetailById,
18
- findBusAll,
19
22
  findOperatorAll,
20
23
  findZoneAll,
21
24
  findBusDetailByOperator,
22
- findOpenHoursAll
25
+ findOpenHoursAll,
26
+ findStopByRef,
27
+ findBusByStopLabel,
28
+ findBusByTwoStopLabel
23
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bus-mj",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "package for BUS station in Mahajanga",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/getBus.js CHANGED
@@ -61,7 +61,7 @@ export function findBusByOneStop(stop_id) {
61
61
 
62
62
  /**
63
63
  * find Bus that have a one stop asked
64
- * @param {number} stop_label label of stop
64
+ * @param {string} stop_label label of stop
65
65
  * @returns { Bus[] }
66
66
  */
67
67
  export function findBusByStopLabel(stop_label) {
@@ -98,7 +98,12 @@ export function findBusByTwoStopLabel(begin, end) {
98
98
  const endIndex = relation.members.findIndex(
99
99
  (member) => member.label && member.label.toUpperCase() == end.toUpperCase()
100
100
  );
101
- return beginIndex != -1 && endIndex != -1 && beginIndex < endIndex;
101
+
102
+ if (beginIndex === -1 || endIndex === -1 || beginIndex >= endIndex) return false;
103
+
104
+ // Couper members à l'intervalle [begin, end]
105
+ relation.members = relation.members.slice(beginIndex, endIndex + 1);
106
+ return true;
102
107
  });
103
108
  }
104
109