plugins/lanyrd.js
function fetch(identity, options, callback){
			var completed  = 0
				combinedProfile = {};

		    // this is called once a page is fully parsed
		   	function whenFetched(err, data){
		      completed ++;

		      // combines the api and microformats data into one profile
		      if(data){
			      if(data.fn) {combinedProfile.fn = data.fn};
			      if(data.n) {combinedProfile.n = data.n};
			      if(data.nickname) {combinedProfile.nickname = data.nickname};
				  if(data.photo) {combinedProfile.photo = data.photo};
				  if(data.note) {combinedProfile.note = data.note};
				  // for the moment exclude microformat url structures
				  if(data.url && data.source === 'api') {
				  	if(!combinedProfile.url) {combinedProfile.url = []};
				  	var i = data.url.length;
					while (i--) {
				  		appendUrls(data.url[i], combinedProfile.url);
				  	}
				  };
			  }

			  // once we have both bit of data fire callback
		      if(completed === 2){
		        callback(combinedProfile);
		      }  
		    }

		    // get microformats data
		    getUFData(identity.userName, identity, options, function(err,data){
		    	whenFetched(err, data);
		    });

		    // get api data
		    getAPIData(identity.userName, options, function(err,data){
		    	whenFetched(err, data);
		    });
		 }
function fetch(identity, options, callback){
			var completed  = 0
				combinedProfile = {};

		    // this is called once a page is fully parsed
		   	function whenFetched(err, data){
		      completed ++;

		      // combines the api and microformats data into one profile
		      if(data){
			      if(data.fn) {combinedProfile.fn = data.fn};
			      if(data.n) {combinedProfile.n = data.n};
			      if(data.nickname) {combinedProfile.nickname = data.nickname};
				  if(data.photo) {combinedProfile.photo = data.photo};
				  if(data.note) {combinedProfile.note = data.note};
				  // for the moment exclude microformat url structures
				  if(data.url && data.source === 'api') {
				  	if(!combinedProfile.url) {combinedProfile.url = []};
				  	var i = data.url.length;
					while (i--) {
				  		appendUrls(data.url[i], combinedProfile.url);
				  	}
				  };
			  }

			  // once we have both bit of data fire callback
		      if(completed === 2){
		        callback(combinedProfile);
		      }  
		    }

		    // get microformats data
		    getUFData(identity.userName, identity, options, function(err,data){
		    	whenFetched(err, data);
		    });

		    // get api data
		    getAPIData(identity.userName, options, function(err,data){
		    	whenFetched(err, data);
		    });
		 }
function fetch ( identity , options , callback ) { var completed = 0 combinedProfile = { } ; // this is called once a page is fully parsed function whenFetched ( err , data ) { completed ++ ; // combines the api and microformats data into one profile if ( data ) { if ( data . fn ) { combinedProfile . fn = data . fn } ; if ( data . n ) { combinedProfile . n = data . n } ; if ( data . nickname ) { combinedProfile . nickname = data . nickname } ; if ( data . photo ) { combinedProfile . photo = data . photo } ; if ( data . note ) { combinedProfile . note = data . note } ; // for the moment exclude microformat url structures if ( data . url && data . source === 'api' ) { if ( ! combinedProfile . url ) { combinedProfile . url = [ ] } ; var i = data . url . length ; while ( i -- ) { appendUrls ( data . url [ i ] , combinedProfile . url ) ; } } ; } // once we have both bit of data fire callback if ( completed === 2 ) { callback ( combinedProfile ) ; } } // get microformats data getUFData ( identity . userName , identity , options , function ( err , data ) { whenFetched ( err , data ) ; } ) ; // get api data getAPIData ( identity . userName , options , function ( err , data ) { whenFetched ( err , data ) ; } ) ; }
fetch both api and microformats data and then mix together
fetch both api and microformats data and then mix together