Very nice article, will keep that in mind when trying to help others with promises. Also helped me to re-understand some things :)
One thing though, Advanced mistake #4, is in my opinion good answer, the Q library however gives a (afaik) non-a+-standard way of doing that which I like:
from:
getUserByName('nolan').then(function (user) {
return getUserAccountById(user.id);
}).then(function (userAccount) {
// dangit, I need the "user" object too!
});
to:
getUserByName('nolan').then(function (user) {
return [user, getUserAccountById(user.id)];
}).spread(function (user, userAccount) {
// I do have the user object here
});
One thing though, Advanced mistake #4, is in my opinion good answer, the Q library however gives a (afaik) non-a+-standard way of doing that which I like:
from:
to: