@wemap/osm 2.7.4 → 2.7.5

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/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "directory": "packages/osm"
12
12
  },
13
13
  "name": "@wemap/osm",
14
- "version": "2.7.4",
14
+ "version": "2.7.5",
15
15
  "bugs": {
16
16
  "url": "https://github.com/wemap/wemap-modules-js/issues"
17
17
  },
@@ -32,5 +32,5 @@
32
32
  "lodash.isnumber": "^3.0.3",
33
33
  "sax": "^1.2.4"
34
34
  },
35
- "gitHead": "346dd50c4934b77b831a081f3543405865f1a65e"
35
+ "gitHead": "5d60aa9ae789520ef5adeb34a8e4d3e5973ed0b2"
36
36
  }
@@ -231,9 +231,12 @@ class OsrmUtils {
231
231
  }
232
232
  step.nodes.push(node);
233
233
 
234
+ const isFirstNode = coordinates[0] === coords;
234
235
  const isLastNode = coordinates[coordinates.length - 1] === coords;
235
- if (!isLastNode || step.lastStep) {
236
+ if (isFirstNode) {
236
237
  itinerary._nextStepsIndexes.push(i);
238
+ } else if (!isLastNode) {
239
+ itinerary._nextStepsIndexes.push(i + 1);
237
240
  }
238
241
 
239
242
  if (previousNode) {
@@ -85,13 +85,13 @@ describe('OsrmUtils', () => {
85
85
  expect(step.name).equals('Rue du Docteur Louis Perrier');
86
86
 
87
87
  expect(itinerary._nextStepsIndexes.length).equals(itinerary.nodes.length);
88
- for (let i = 0; i <= 4; i++) {
89
- expect(itinerary._nextStepsIndexes[i]).equals(0);
90
- }
91
- for (let i = 5; i <= 15; i++) {
88
+ expect(itinerary._nextStepsIndexes[0]).equals(0);
89
+ for (let i = 1; i <= 5; i++) {
92
90
  expect(itinerary._nextStepsIndexes[i]).equals(1);
93
91
  }
94
- expect(itinerary._nextStepsIndexes[16]).equals(2);
92
+ for (let i = 6; i <= 16; i++) {
93
+ expect(itinerary._nextStepsIndexes[i]).equals(2);
94
+ }
95
95
  expect(itinerary._nextStepsIndexes[17]).equals(3);
96
96
  expect(itinerary._nextStepsIndexes[18]).equals(4);
97
97
  });