Skip to content

Commit

Permalink
Correct promise.tap "equivalent" explanation
Browse files Browse the repository at this point in the history
I'm far from certain about this, but I don't think the "equivalent" JS code for `promise.tap` was correct.

According to the description of the function, `promise.tap` should wait for `doSideEffectsHere`'s return, and should reject if `doSideEffectsHere()` returns a rejected promise. Which the "equivalent" code didn't achieve. I think.
  • Loading branch information
stevage committed Feb 15, 2016
1 parent 1516d79 commit 3d2b25f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions docs/api.md
Expand Up @@ -579,8 +579,7 @@ These are equivalent:
```js
// Using only .then()
promise.then(function(x) {
doSideEffectsHere(x);
return x;
return when(doSideEffectsHere(x)).yield(x);
});

// Using .tap()
Expand Down

0 comments on commit 3d2b25f

Please sign in to comment.