Chain over the "rejected" side of an `Async`
See original GitHub issueI would like to request the ability to chain over the left or “rejected” side of an Async
. This would be helpful to move values from the left side of the Async
to the right.
getAsync()
.chainRej(ifElse(isErrorOk, constant(Async.of('Error Ignored')), Async.Rejected))
I’m currently doing this with a helper function.
// chainRej :: (a -> Async e a) -> Async a b -> Async e a|b
export const chainRej = curry((fn, a) =>
Async((rej, res) => a.fork(x => fn(x).fork(rej, res), res))
)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Unhandle rejection promise async await chain - Stack Overflow
In the analyze() you are returning Project.reject() but analyze() is an async function. Therefor it resolves any value that you return and ...
Read more >Promises chaining - The Modern JavaScript Tutorial
In this chapter we cover promise chaining. It looks like this: new Promise(function(resolve, reject) { setTimeout(() => resolve(1), 1000); ...
Read more >JavaScript Promise Tutorial: Resolve, Reject, and Chaining in ...
Representation of the process of Promises But if we don't get the information, then the Promise will be in the rejected state. Additionally,...
Read more >Handling those unhandled promise rejections with JS async ...
The Problem · You put your code inside an async function in order to use await calls · You put an await call...
Read more >async function - JavaScript - MDN Web Docs - Mozilla
In concurrentPromise , Promise.all wires up the promise chain in one go, meaning that the operation will fail-fast regardless of the order of ......
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 FreeTop 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
Top GitHub Comments
bichain
sounds like a win to me.@mgreystone There is a PR ready for
bichain
sitting here, https://github.com/evilsoft/crocks/pull/394 if you have time, check it out and let me know if you see any opportunities for improvement