index.js
// make an object containing only relevant data and push to evArr
make an object containing only relevant data and push to evArr
make an object containing only relevant data and push to evArr
function makeEventO(resp) {
  var evObj = {};
  for (var i=0; i<resp.length; i++) {
    for (var prop in resp[i]) {
      if (prop === 'venue') {
        evObj['name'] = resp[i].venue.name;
        evObj['city'] = resp[i].venue.city;
        evObj['region'] =resp[i].venue.region;
        evObj['latitude'] = parseFloat(resp[i].venue.latitude);
        evObj['longitude'] = parseFloat(resp[i].venue.longitude);
      }
      if (prop === 'id') {
        evObj['eventId'] = resp[i][prop];
      }
      if (prop === 'artists') { 
        evObj['artists'] = resp[i][prop][0].name;
      }
      if (prop === 'formatted_datetime') {
        evObj['formatted_datetime'] = resp[i][prop];
      }
      if (prop === 'ticket_status') {
        evObj['ticket_status'] = resp[i][prop];
      }
      if (prop === 'ticket_url') {
        evObj['ticket_url'] = resp[i][prop];
      }
    }
    evArr.push(evObj);
    evObj = {}; 
  }
  console.log('eventArr:', evArr);
  return evArr;
}
function makeEventO ( resp ) { var evObj = { } ; for ( var i = 0 ; i < resp . length ; i ++ ) { for ( var prop in resp [ i ] ) { if ( prop === 'venue' ) { evObj [ 'name' ] = resp [ i ] . venue . name ; evObj [ 'city' ] = resp [ i ] . venue . city ; evObj [ 'region' ] = resp [ i ] . venue . region ; evObj [ 'latitude' ] = parseFloat ( resp [ i ] . venue . latitude ) ; evObj [ 'longitude' ] = parseFloat ( resp [ i ] . venue . longitude ) ; } if ( prop === 'id' ) { evObj [ 'eventId' ] = resp [ i ] [ prop ] ; } if ( prop === 'artists' ) { evObj [ 'artists' ] = resp [ i ] [ prop ] [ 0 ] . name ; } if ( prop === 'formatted_datetime' ) { evObj [ 'formatted_datetime' ] = resp [ i ] [ prop ] ; } if ( prop === 'ticket_status' ) { evObj [ 'ticket_status' ] = resp [ i ] [ prop ] ; } if ( prop === 'ticket_url' ) { evObj [ 'ticket_url' ] = resp [ i ] [ prop ] ; } } evArr . push ( evObj ) ; evObj = { } ; } console . log ( 'eventArr:' , evArr ) ; return evArr ; }
make an object containing only relevant data and push to evArr
make an object containing only relevant data and push to evArr
// might have to rework if multiple artists // clear out the old contents