]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions/graphhopper.js
Simplify step mapping function
[rails.git] / app / assets / javascripts / index / directions / graphhopper.js
index acbd776a0c86783be40a0ed553136f73a47415e9..3579fd168aa8d4fc69e8f94020238e31b8c0430e 100644 (file)
     function _processDirections(path) {
       const line = L.PolylineUtil.decode(path.points);
 
     function _processDirections(path) {
       const line = L.PolylineUtil.decode(path.points);
 
-      const steps = path.instructions.map(function (instr) {
-        const lineseg = line
-          .slice(instr.interval[0], instr.interval[1] + 1);
-        return [
-          GH_INSTR_MAP[instr.sign],
-          instr.text,
-          instr.distance,
-          lineseg
-        ];
-      });
+      const steps = path.instructions.map(instr => [
+        GH_INSTR_MAP[instr.sign],
+        instr.text,
+        instr.distance,
+        line.slice(instr.interval[0], instr.interval[1] + 1)
+      ]);
       steps.at(-1)[0] = "destination";
 
       return {
       steps.at(-1)[0] = "destination";
 
       return {