Skip to content

Commit

Permalink
refactor(propagation): Replace let with const where possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwigway committed Oct 27, 2016
1 parent c8533da commit 3456a5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/get-spectrogram-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const MAX_TRIP_LENGTH = 120 // minutes
* marginal opportunities reachable in 120 minutes]
*/
export default function getSpectrogramData ({origin, query, stopTreeCache, grid}) {
let output = []
const output = []
for (let i = 0; i < origin.nMinutes; i++) output.push(new Uint32Array(MAX_TRIP_LENGTH))

propagate({
Expand All @@ -35,7 +35,7 @@ export default function getSpectrogramData ({origin, query, stopTreeCache, grid}
const val = grid.data[gridy * grid.width + gridx]

for (let i = 0; i < travelTimesForDest.length; i++) {
let time = travelTimesForDest[i]
const time = travelTimesForDest[i]
if (time === 255) continue // unreachable

if (time < MAX_TRIP_LENGTH) {
Expand Down
6 changes: 3 additions & 3 deletions lib/propagation.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ export default function propagate ({ query, stopTreeCache, origin, callback }) {
// no need to check that travelTimeToPixel < 255 as travelTimesForDest[minute] is preinitialized to the nontransit time or 255
if (travelTimesForDest[minute] > travelTimeToPixel) {
travelTimesForDest[minute] = travelTimeToPixel
let inVehicle = inVehicleTravelTimesForDest[minute] = origin.data[offset + 1]
let wait = waitTimesForDest[minute] = origin.data[offset + 2]
const inVehicle = inVehicleTravelTimesForDest[minute] = origin.data[offset + 1]
const wait = waitTimesForDest[minute] = origin.data[offset + 2]
// NB when we're talking about a particular trip, then walk + wait + inVehicle == total
// However if you calculate summary statistics for each of these individually, that may
// not be true. So we need to calculate walk here and explicitly calculate summary stats about it.
let walkTime = travelTimeToPixel - wait - inVehicle
const walkTime = travelTimeToPixel - wait - inVehicle
walkTimesForDest[minute] = walkTime
}
}
Expand Down

0 comments on commit 3456a5d

Please sign in to comment.