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

Add stream transformation use case example #144

Merged
merged 1 commit into from
Dec 22, 2018

Conversation

felixfbecker
Copy link
Contributor

Add example explaining how the pipeline operator helps with transforming Iterable, AsyncIterable, Observable and streams.

Copy link
Member

@littledan littledan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, but I have also heard from RxJS folks that pipeline would be a big improvement. Maybe we could get a code sample from there as well. Cc @benlesh

@felixfbecker
Copy link
Contributor Author

Yup, I second that! The example I have:

Observable.from([1, 2, 3]).pipe(
  filter(x => x % 2 === 1),
  map(x => x + x)
)

would become this with the pipeline operator:

[1, 2, 3]
  |> filter(x => x % 2 === 1)
  |> map(x => x + x)

Do you think it's worth adding that too?

@felixfbecker felixfbecker deleted the patch-1 branch December 22, 2018 23:36
@littledan
Copy link
Member

Yes, I think that'd be a good idea.

@benlesh
Copy link

benlesh commented Dec 26, 2018

Looks great. There is more I would say about this "pipeable operator" pattern in RxJS, since it's been in use for more than a year now. There are patterns that have emerged from this that make code more readable and testable than it would otherwise be if we used "dot-chained" operators. I'll try to add more in another PR soon.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants