@wemap/osm 5.0.6 → 5.1.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.
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "directory": "packages/osm"
12
12
  },
13
13
  "name": "@wemap/osm",
14
- "version": "5.0.6",
14
+ "version": "5.1.0",
15
15
  "bugs": {
16
16
  "url": "https://github.com/wemap/wemap-modules-js/issues"
17
17
  },
@@ -29,7 +29,7 @@
29
29
  "@wemap/geo": "^5.0.3",
30
30
  "@wemap/logger": "^5.0.0",
31
31
  "@wemap/maths": "^5.0.0",
32
- "sax": "^1.2.4"
32
+ "saxes": "^5.0.1"
33
33
  },
34
- "gitHead": "412142e60e70b1e18989c616c6c7d3b6f577ef2c"
34
+ "gitHead": "0133b575647d871440689d4388edcfd45870cc51"
35
35
  }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable max-statements */
2
- import sax from 'sax';
2
+ import { SaxesParser } from 'saxes';
3
3
 
4
4
  import {
5
5
  Level, Coordinates
@@ -18,13 +18,13 @@ class OsmParser {
18
18
  static parseOsmXmlString(osmXmlString) {
19
19
 
20
20
  const model = new OsmModel();
21
- const parser = sax.parser(true);
21
+ const parser = new SaxesParser(true);
22
22
 
23
23
  let buffer;
24
24
 
25
25
  const isDeleted = element => element.attributes.action && element.attributes.action === 'delete';
26
26
 
27
- parser.onopentag = (node) => {
27
+ parser.on('opentag', (node) => {
28
28
 
29
29
  switch (node.name) {
30
30
  case 'node': {
@@ -72,7 +72,7 @@ class OsmParser {
72
72
  break;
73
73
  }
74
74
  }
75
- };
75
+ });
76
76
 
77
77
  parser.write(osmXmlString);
78
78
 
@@ -145,6 +145,7 @@ class Itinerary {
145
145
  return acc;
146
146
  }, 0);
147
147
  leg.duration = leg.distance;
148
+ itinerary.legs.push(leg);
148
149
 
149
150
  itinerary.distance = leg.distance;
150
151
  itinerary.duration = leg.duration;