Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate-Wessel committed Jan 17, 2024
1 parent 4d259b9 commit 4ff4ef2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frontend/src/travelTimeQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ export class TravelTimeQuery {
record.set('hoursInRange', this.hoursInRange)
record.set('estimatedVehicleCount', this.#estimatedSample)
record.set('mean_travel_time_minutes', this.#travelTime)

if(type=='json'){
// can't JSONify maps
return Object.fromEntries(record)
return Object.fromEntries(record) // can't JSONify maps
}else if(type=='csv'){
// add double quotes to strings and concatenate
return [...record.values()]
// add double quotes to strings and concatenate
.map( value => typeof value == 'string' ? `"${value}"` : value )
.join(',')
}
// the keys of a map record are used to create the CSV header
return record
}
}

0 comments on commit 4ff4ef2

Please sign in to comment.