Deferred anti-pattern happens when new redundant deferred object is created to be resolved from inside an promise chain.
In your case you already have a Promise object, so you just need to return doSomethingAsync()
result:
function foo() {
return doSomethingAsync().then(function (result) {
return doSomethingToTheResult(result);
});
};
Would the above ensure that the transformed result is used further down the promise chain?
Yes, exactly, this is one of the coolest things about promises.