- const steps = leg.steps.map(function (step) {
- const maneuver_id = getManeuverId(step.maneuver);
- const step_geometry = L.PolylineUtil.decode(step.geometry, { precision: 5 });
- const instText = getInstructionText(step, maneuver_id);
- return [
- ICON_MAP[maneuver_id],
- instText,
- step.distance,
- step_geometry
- ];
- });
+ for (const step of leg.steps) step.maneuverId = getManeuverId(step.maneuver);
+
+ const steps = leg.steps.map(step => [
+ ICON_MAP[step.maneuverId],
+ getInstructionText(step),
+ step.distance,
+ L.PolylineUtil.decode(step.geometry, { precision: 5 })
+ ]);