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 takeWhileInclusive operator #383

Merged
merged 2 commits into from
Feb 4, 2020
Merged

Add takeWhileInclusive operator #383

merged 2 commits into from
Feb 4, 2020

Conversation

hoc081098
Copy link
Collaborator

@codecov-io
Copy link

Codecov Report

Merging #383 into master will increase coverage by 0.09%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #383      +/-   ##
==========================================
+ Coverage   93.35%   93.44%   +0.09%     
==========================================
  Files          59       60       +1     
  Lines        2016     2044      +28     
==========================================
+ Hits         1882     1910      +28     
  Misses        134      134

@frankpepermans
Copy link
Member

I was just going to open a PR for exactly this, but you beat me to it hehe :)

I'll check it asap, many thanks!

} catch (e, s) {
controller.addError(e, s);
// The test didn't say true. Didn't say false either, but we stop anyway.
controller.close();
Copy link
Member

Choose a reason for hiding this comment

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

This line should be removed:
upon listening, one can choose to set cancelOnError: false

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This behavior is same as Stream.takeWhile, https://dartpad.dartlang.org/8949740dda7ba576ed0241089a5041da

Copy link
Member

Choose a reason for hiding this comment

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

Heh you're right :)
In that case it's best to do the same thing indeed!


/// Emits values emitted by the source Stream so long as each value
/// satisfies the given test. When the test is not satisfied by a value, will
/// emit it and complete.
Copy link
Member

Choose a reason for hiding this comment

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

Just wording here: I'd use "... it will emit this value as a final event and then complete "

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed :))

extension TakeWhileInclusiveExtension<T> on Stream<T> {
/// Emits values emitted by the source Stream so long as each value
/// satisfies the given test. When the test is not satisfied by a value, will
/// emit it and complete.
Copy link
Member

Choose a reason for hiding this comment

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

same as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed :))

Copy link
Member

@frankpepermans frankpepermans left a comment

Choose a reason for hiding this comment

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

Thanks for helping out!

@brianegan
Copy link
Collaborator

Thanks so much, @hoc081098, and sorry about the delay! I'll merge this in :)

@brianegan brianegan merged commit ff0a6d7 into ReactiveX:master Feb 4, 2020
@hoc081098 hoc081098 deleted the take_while_inclusive branch February 21, 2020 08:13
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

Successfully merging this pull request may close these issues.

4 participants