user.some(function(value) {
CreateRoomHash(userID, value._id, function (err, roomhash) {
if(err) console.log(err);
if(roomhash) {
console.log("ROOMHASH:" + roomhash);
retrieveRoom(roomhash, function(err, room) {
if(err) console.log(err);
if(room) {
console.log("ROOM FOUND: " + room);
if(room.status) {
console.log("Existing room found:"+ roomsha);
JoinRoom(roomsha);
response.json({Roomhash: roomsha});
return true;
} else {
console.log("ROOM STATUS IS FALSE");
return false;
}
} else {
console.log("ROOM NOT FOUND");
var newRoom = CreateRoom(roomsha, userID, matchedID);
console.log("No existing room found, new room created:" + roomsha);
response.json({Roomhash: newRoom});
return true;
}
});
console.log("COOL:"+cool)
}
console.log("COOL:"+cool)
});
});
});
Beginner here. I have two nested callback functions, CreateRoomHash and retrive Room. How do return true or false for either of my callback functions so I can break out of my some()?