-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(operator): add skipWhile operator #703
Conversation
828ae99
to
ac093f7
Compare
var expected = '----------------|'; | ||
|
||
expectObservable(source.skipWhile(function () { return {}; })).toBe(expected); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test case where the predicate throws an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot this one !
In RxJS4, the predicate function takes as third argument (after the value and index) the observable object being subscribed... I'm not sure what is the purpose of this and could not find any... Do you think we need to keep it ? |
} | ||
|
||
_next(value: T): void { | ||
const destination = this.destination; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like for everything else, you could store const skipping = this.skipping
since it's used multiple times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really because it is mutated on line 40.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, correct.
I think PR's OK. @jinroh , you're fast! :) |
I believe we kept it in |
import {errorObject} from '../util/errorObject'; | ||
import {bindCallback} from '../util/bindCallback'; | ||
|
||
export function skipWhile<T>(predicate: (x: T, index: number) => boolean, thisArg?: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should define a return value of : Observable<T>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
Actually, there are mixture currently, refer |
Oops didn't mean to close. Fat fingers. Anyhow...
That's fine. It really doesn't make much sense anyhow. |
: +1 too. Maybe can discuss later to find if anyone has usecase. |
I think most of issues in this PR's now settled down, will merge in around hr. (having around hr of buffer just in case if @Blesh might have some additional suggestion) |
@kwonoj 👍 LGTM |
(#696)
Waiting for your reviews !