docs: function extractTravelPlan(data) {
    let plans = []
    let getPlan = searchPlan => plans.find(plan => samePlan(plan, searchPlan))
  
    data.folders.forEach(folder => {
      let cents = folder.cents
      if (folder.cents === undefined) { return }
      let from = stationDataFromId(folder.departure_station_id, data)
      let to = stationDataFromId(folder.arrival_station_id, data)
      let departure = (new Date(folder.departure_date)).toISOString()
      let arrival = (new Date(folder.arrival_date)).toISOString()
  
      let tripId = folder.trip_ids[0]
      let trip = data.trips.find(trip => trip.id === tripId)
      let segments = trip.segment_ids.map(segmentId =>
        data.segments.find(segment => segment.id === segmentId)
      )
      let legs = segments.map(segment => ({
        from: stationDataFromId(segment.departure_station_id, data),
        to: stationDataFromId(segment.arrival_station_id, data),
        departure: (new Date(segment.departure_date)).toISOString(),
        arrival: (new Date(segment.arrival_date)).toISOString(),
      }))
      let searchPlan = {fares: [], legs}
      let plan = getPlan(searchPlan)
  
      if (plan === undefined) {
        plan = searchPlan
        plans.push(plan)
  
      } else if
        // If that price is already in the plan, no need to add to it.
        (plan.fares.find(fare => fare.price[0].cents === cents) !== undefined) {
        return
      }
  
  
      plan.fares.push({
        price: [{ cents: folder.cents, currency: folder.currency }],
        class: travelClass(folder.travel_class),
        flexibility: flexibility(folder.flexibility),
      })
    })
    return plans
  }