Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlatTap #616

Open
irony opened this issue Apr 20, 2017 · 2 comments
Open

FlatTap #616

irony opened this issue Apr 20, 2017 · 2 comments

Comments

@irony
Copy link

irony commented Apr 20, 2017

When dealing with promises it would be nice to be able to do a stream.flatTap(_(save)) which would disregard the output but wait for the promise to resolve. (shorthand for stream.flatMap(item => _(save(item).then(() => item)))

@vqvu
Copy link
Collaborator

vqvu commented Apr 21, 2017

I guess I wouldn't mind adding something like this since we already have tap, but it would work with streams, not promises. Highland isn't a promises library, so the only direct integration point with promises is the constructor.

So stream.flatTap(save) would be shorthand for stream.flatMap(item => save(item).filter(() => false).append(item)), where save returns a Highland stream. Which means, when working with promises, you'd still have to do stream.flatTap(item => _(save(item))). At that point, I'm not sure it's saving you much at all.

But if you want to submit a PR, I'll accept it.

@tomwhale
Copy link

tomwhale commented Jul 4, 2018

I also agree this could be useful - we use this a lot in our codebase for varying reasons.

Made a PR: #651

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants