Promises .then. , , ", require('bluebird/promise')".
, , , , , , .then, . :
function myFn() {
return doPromise1().then(x => {
return doPromise2();
});
}
.then , doPromise2(). 2 - promises .
, 3 then. , , . , , . typechecking, if p instanceof Promise, , . - , : if (typeof p.then === 'function').
true , , - . , , .