@opentripplanner/core-utils
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -17,2 +17,3 @@ "use strict"; | ||
exports.isEScooterStation = isEScooterStation; | ||
exports.isCarWalkTransition = isCarWalkTransition; | ||
exports.isValidLat = isValidLat; | ||
@@ -123,3 +124,3 @@ exports.isValidLng = isValidLng; | ||
}); | ||
itin.legs.forEach(leg => { | ||
itin.legs.forEach((leg, idx) => { | ||
if (leg.mode === "WALK" || leg.mode === "BICYCLE" || leg.mode === "CAR" || leg.mode === "MICROMOBILITY") { | ||
@@ -132,2 +133,5 @@ let fromPlaceId; | ||
fromPlaceId = `escooter_rent_station_${leg.from.name}`; | ||
} else if (leg.mode === "CAR" && idx > 0 && itin.legs[idx - 1].mode === "WALK") { | ||
// create a special place ID for car legs preceeded by walking legs | ||
fromPlaceId = `itin_car_${streetEdgeId}_from`; | ||
} else { | ||
@@ -143,2 +147,5 @@ fromPlaceId = `itin_street_${streetEdgeId}_from`; | ||
toPlaceId = `escooter_rent_station_${leg.to.name}`; | ||
} else if (leg.mode === "CAR" && idx < itin.legs.length - 1 && itin.legs[idx + 1].mode === "WALK") { | ||
// create a special place ID for car legs followed by walking legs | ||
toPlaceId = `itin_car_${streetEdgeId}_to`; | ||
} else { | ||
@@ -275,2 +282,6 @@ toPlaceId = `itin_street_${streetEdgeId}_to`; | ||
function isCarWalkTransition(place) { | ||
return place.place_id.lastIndexOf("itin_car_") !== -1; | ||
} | ||
function isValidLat(lat) { | ||
@@ -277,0 +288,0 @@ return Number.isFinite(lat) && lat >= -90 && lat <= 90; |
{ | ||
"name": "@opentripplanner/core-utils", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Core functionality that is shared among numerous UI components", | ||
@@ -20,3 +20,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "182b15d86d0576cb8ae8de035dea887258baaf03" | ||
"gitHead": "3a8343a9af0468f457bff111a66bb0c98098b6c5" | ||
} |
@@ -105,3 +105,3 @@ import moment from "moment"; | ||
itin.legs.forEach(leg => { | ||
itin.legs.forEach((leg, idx) => { | ||
if ( | ||
@@ -118,2 +118,9 @@ leg.mode === "WALK" || | ||
fromPlaceId = `escooter_rent_station_${leg.from.name}`; | ||
} else if ( | ||
leg.mode === "CAR" && | ||
idx > 0 && | ||
itin.legs[idx - 1].mode === "WALK" | ||
) { | ||
// create a special place ID for car legs preceeded by walking legs | ||
fromPlaceId = `itin_car_${streetEdgeId}_from`; | ||
} else { | ||
@@ -128,2 +135,9 @@ fromPlaceId = `itin_street_${streetEdgeId}_from`; | ||
toPlaceId = `escooter_rent_station_${leg.to.name}`; | ||
} else if ( | ||
leg.mode === "CAR" && | ||
idx < itin.legs.length - 1 && | ||
itin.legs[idx + 1].mode === "WALK" | ||
) { | ||
// create a special place ID for car legs followed by walking legs | ||
toPlaceId = `itin_car_${streetEdgeId}_to`; | ||
} else { | ||
@@ -274,2 +288,6 @@ toPlaceId = `itin_street_${streetEdgeId}_to`; | ||
export function isCarWalkTransition(place) { | ||
return place.place_id.lastIndexOf("itin_car_") !== -1; | ||
} | ||
export function isValidLat(lat) { | ||
@@ -276,0 +294,0 @@ return Number.isFinite(lat) && lat >= -90 && lat <= 90; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174348
5007