2 ms·
If you mean that you can't write `map` which would work for sync and async functions with the same code, that's extremely rare problem IMO. If you really need t
by vbezhenar 4y ago
If you mean that you can't write `map` which would work for sync and async functions with the same code, that's extremely rare problem IMO. If you really need that and don't want to write two versions of code, you can wrap blocking code with promises and use promise API from now on.
- dymk 4y agoIt's not at all a rare problem if you work in codebases involving async code. Many `Promise` APIs exist solely to work around that wart. Higher-order functions are the bread and butter of JS, and increasingly Java (especially modern Java).