Skip to content

Commit

Permalink
fix(TakeOperator): terminate stream emission when TakeOperator recurs…
Browse files Browse the repository at this point in the history
…ively call itself

staltz#158
  • Loading branch information
midnight-wonderer committed Dec 16, 2016
1 parent f4dcbbe commit 3f30476
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1177,9 +1177,10 @@ export class TakeOperator<T> implements Operator<T, T> {
_n(t: T) {
const u = this.out;
if (u === NO) return;
if (this.taken++ < this.max - 1) {
const taken = ++this.taken;
if (taken < this.max) {
u._n(t);
} else {
} else if (taken == this.max) {
u._n(t);
u._c();
}
Expand Down

0 comments on commit 3f30476

Please sign in to comment.