Sorry i couldn't come up with a straight forward question/title, but here's the thing. I have the following construct:
var userProvider=function(login){
this.getUser=mongoose.find(login).exec();
}
userProvider.prototype.doStuffWithUserData=function(){
this.getUser.then(function(user){
...
});
}
userProvider.prototype.doOtherStuffWithUserData=function(){
this.getUser.then(function(user){
...
});
}
Is there a a nicer way, such that i don't need to call the promise in every prototype function, though the prototype functions being evaluated only until the data is there?