function reducePeerConnections(peerConnections) {
  return Array.from(peerConnections.reduce(function (peerConnectionsById, update) {
    var reduced = peerConnectionsById.get(update.id) || update;

    // First, reduce the top-level `description` property.
    if (!reduced.description && update.description) {
      reduced.description = update.description;
    } else if (reduced.description && update.description) {
      if (update.description.revision > reduced.description.revision) {
        reduced.description = update.description;
      }
    }

    // Then, reduce the top-level `ice` property.
    if (!reduced.ice && update.ice) {
      reduced.ice = update.ice;
    } else if (reduced.ice && update.ice) {
      if (update.ice.revision > reduced.ice.revision) {
        reduced.ice = update.ice;
      }
    }

    // Finally, update the map.
    peerConnectionsById.set(reduced.id, reduced);
    return peerConnectionsById;
  }, new Map()).values());
}
/**
 * @event TwilioConnectionTransport#message
 * @param {object} peerConnections
 */
@event TwilioConnectionTransport#message
@param {object} peerConnections
@event TwilioConnectionTransport#message @param { object } peerConnections
function reducePeerConnections(peerConnections) {
  return Array.from(peerConnections.reduce(function (peerConnectionsById, update) {
    var reduced = peerConnectionsById.get(update.id) || update;
    if (!reduced.description && update.description) {
      reduced.description = update.description;
    } else if (reduced.description && update.description) {
      if (update.description.revision > reduced.description.revision) {
        reduced.description = update.description;
      }
    }
    if (!reduced.ice && update.ice) {
      reduced.ice = update.ice;
    } else if (reduced.ice && update.ice) {
      if (update.ice.revision > reduced.ice.revision) {
        reduced.ice = update.ice;
      }
    }
    peerConnectionsById.set(reduced.id, reduced);
    return peerConnectionsById;
  }, new Map()).values());
}
function reducePeerConnections ( peerConnections ) { return Array . from ( peerConnections . reduce ( function ( peerConnectionsById , update ) { var reduced = peerConnectionsById . get ( update . id ) || update ; if ( ! reduced . description && update . description ) { reduced . description = update . description ; } else if ( reduced . description && update . description ) { if ( update . description . revision > reduced . description . revision ) { reduced . description = update . description ; } } if ( ! reduced . ice && update . ice ) { reduced . ice = update . ice ; } else if ( reduced . ice && update . ice ) { if ( update . ice . revision > reduced . ice . revision ) { reduced . ice = update . ice ; } } peerConnectionsById . set ( reduced . id , reduced ) ; return peerConnectionsById ; } , new Map ( ) ) . values ( ) ) ; }
@event TwilioConnectionTransport#message
 @param {object} peerConnections
@event TwilioConnectionTransport#message @param { object } peerConnections
// First, reduce the top-level `description` property. // Then, reduce the top-level `ice` property. // Finally, update the map.