Peep is always returned from the function as undefined. Can someone point me to the problem? In the success function the snapshot is returned as expected. I think it's a scoping issue.
function getPerson( id ) {
var ref = new Firebase( "https://foo.firebaseio.com/people/" + id ),
peep;
// Attach an asynchronous callback to read the data at our people reference
ref.once( "value", function( snapshot ) {
//success
peep = snapshot;
}, function ( errorObject ) {
//error
//console.log( "The read failed: " + errorObject.code );
});
return peep;
}