tap with promise chains
See original GitHub issueI’d like to add tap variant to a promise chain (from composeP or pipeP) with the idea that the tap is dealing with a promise. Does a tapP function have any use? Or do we just do
var tapP = function (fn) {
return function (promise) {
return promise
.then(function (x) {
fn(x);
return promise;
});
};
};
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Tap into promise chains for debugging - Gleb Bahmutov
Let me show how combining promises can be simple if we separate building individual steps from linking them into a directed graph. Let...
Read more >.tap | bluebird
In other words: throwing or returning a rejected/eventually-rejected promise will disrupt the chain as usual, but returning a value or a fulfilled/eventually- ...
Read more >sindresorhus/p-tap: Tap into a promise chain ... - GitHub
tapHandler. Type: Function. Any return value is ignored. Exceptions thrown in tapHandler are relayed back to the original promise chain.
Read more >Javascript Promise Chain Example Explained - YouTube
Javascript Promise Chain Execution Order Explained. In this tutorial, we explain how promises work in Javascript and how you can control the ...
Read more >Promises chaining - The Modern JavaScript Tutorial
Promises provide a couple of recipes to do that. In this chapter we cover promise chaining. It looks like this: new Promise(function(resolve ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@stevenyap, I recommend a Fantasy Land -compatible Future or Task type such as the one provided by Fluture.
I agree with @davidchambers. The main point is that
Future
/Task
implementations follow known laws and can be used in a manner consistent with many other types.Promise
implementations generally do not.